Linux安装MySQL

Linux安装MySQL,第1张

Linux安装MySQL

上传

查询是否已经安装

rpm -qa|grep My

删除存在的软件包

rpm -e 软件包

[root@hadoop1 mysql-libs]# rpm -qa|grep mariadb

mariadb-libs-5.5.56-2.el7.x86_64

[root@hadoop1 mysql-libs]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

[root@hadoop1 mysql-libs]# yum -y install autoconf

[hadoop@hadoop1 soft]$ sudo yum install zip unzip

[hadoop@hadoop1 soft]$ pwd

/opt/soft

[hadoop@hadoop1 soft]$ ll

total 719948

-rw-r--r--. 1 root root  55711670 May  3 16:07 apache-flume-1.7.0-bin.tar.gz

-rw-r--r--. 1 root root 197657687 May  3 12:01 hadoop-2.7.2.tar.gz

-rw-r--r--. 1 root root  62282700 May  3 11:59 hadoop-lzo-master.zip

-rw-r--r--. 1 root root 185515842 May  3 00:44 jdk-8u144-linux-x64.tar.gz

-rw-r--r--. 1 root root  42136632 May  3 16:37 kafka_2.11-0.11.0.2.tgz

-rw-r--r--. 1 root root   1417459 May  3 16:36 kafka-clients-0.11.0.2.jar

-rw-r--r--. 1 root root  79630940 May  3 16:38 kafka-manager-1.3.3.22.zip

-rw-r--r--. 1 root root  77807942 May  3 17:17 mysql-libs.zip

-rw-r--r--. 1 root root  35042811 May  3 13:46 zookeeper-3.4.10.tar.gz

[hadoop@hadoop1 soft]$ unzip mysql-libs.zip

[hadoop@hadoop1 mysql-libs]$ pwd

/opt/soft/mysql-libs

[hadoop@hadoop1 mysql-libs]$ ll

total 76048

-rw-rw-r--. 1 hadoop hadoop 18509960 Mar 26  2015 MySQL-client-5.6.24-1.el6.x86_64.rpm

-rw-rw-r--. 1 hadoop hadoop  3575135 Dec  1  2013 mysql-connector-java-5.1.27.tar.gz

-rw-rw-r--. 1 hadoop hadoop 55782196 Mar 26  2015 MySQL-server-5.6.24-1.el6.x86_64.rpm

安装服务器

[root@hadoop1 ~]# cd /opt/soft/mysql-libs

[root@hadoop1 mysql-libs]# rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm

[root@hadoop1 mysql-libs]#
cat /root/.mysql_secret

[root@hadoop1 mysql-libs]# service mysql status

 ERROR! MySQL is not running

[root@hadoop1 mysql-libs]# service mysql start

Starting MySQL. SUCCESS!

安装客户端

[root@hadoop1 ~]# cd /opt/soft/mysql-libs

[root@hadoop1 mysql-libs]# rpm -ivh MySQL-client-5.6.24-1.el6.x86_64.rpm

[root@hadoop1 mysql-libs]# mysql -uroot -p

设置密码

SET PASSWORD=PASSWORd('root');

flush privileges;

测试新密码

设置权限

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| test               |

+--------------------+

4 rows in set (0.00 sec)

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> update user set host='%' where host='localhost';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> select User, Host, Password from user;

+------+-----------+-------------------------------------------+

| User | Host      | Password                                  |

+------+-----------+-------------------------------------------+

| root | %         | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |

| root | hadoop1   | *F67C08AD6794B84119DCE43DEF140B182368B10A |

| root | 127.0.0.1 | *F67C08AD6794B84119DCE43DEF140B182368B10A |

| root | ::1       | *F67C08AD6794B84119DCE43DEF140B182368B10A |

+------+-----------+-------------------------------------------+

4 rows in set (0.00 sec)

mysql> delete from user where Host ='hadoop1' or Host='127.0.0.1' or Host='::1';

Query OK, 3 rows affected (0.00 sec)

刷新、退出

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4683818.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-07
下一篇 2022-11-07

发表评论

登录后才能评论

评论列表(0条)

保存