Linux centOS安装MySQL
0、先将原先的MySQL卸载
1、先将安装包放到/opt/software/mysql/下
2、解压
unzip mysql-connector-java-5.1.27.tar.gz
3、安装服务端
sudo rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm
4、安装客户端
sudo rpm -ivh MySQL-client-5.6.24-1.el6.x86_64.rpm
5、启动MySQL服务
sudo service mysql start
6、查看初始密码
sudo cat /root/.mysql_secret
7、使用初始密码登录MySQL
mysql -uroot -pykOCjZ0ML9KJd9qS
8、修改MySQL密码
mysql> set password = password('123');
9、退出MySQL,然后使用新密码重新登录
mysql> quit;
$ mysql -uroot -p123
10、修改root用户远程访问权限
? (1)使用mysql库
mysql> use mysql;
? (2)查看
mysql> select user,host from user;
+------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | root | ::1 | | root | hadoop106 | | root | localhost | +------+-----------+ 4 rows in set (0.00 sec)
? (3)把localhost改成%
mysql> update user set host='%' where host='localhost';
? (4)再次查询
mysql> select user,host from user;
+------+-----------+ | user | host | +------+-----------+ | root | % | | root | 127.0.0.1 | | root | ::1 | | root | hadoop106 | +------+-----------+ 4 rows in set (0.00 sec)
? (5)把其他的用户删除
mysql> delete from user where host!='%';
? (6)刷新
mysql> flush privileges;
? (7)安装完成
mysql> quit;
相关推荐
lpfvip00 2020-10-07
CoderToy 2020-11-16
emmm00 2020-11-17
王艺强 2020-11-17
ribavnu 2020-11-16
bianruifeng 2020-11-16
wangshuangbao 2020-11-13
苏康申 2020-11-13
vivenwan 2020-11-13
moyekongling 2020-11-13
云中舞步 2020-11-12
要啥自行车一把梭 2020-11-12
aydh 2020-11-12
kuwoyinlehe 2020-11-12
minerk 2020-11-12
vitasfly 2020-11-12
jazywoo在路上 2020-11-11
敏敏张 2020-11-11