CentOs 安装 Mysql

本文源于 网上, 我只是加以验证:

https://blog.csdn.net/czmchen/article/details/46645763

https://jingyan.baidu.com/article/86fae346aa437f3c48121a5b.html

1:  安装nysql

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server

2:  启动

# service mysqld restart

3: 进入MySQL 并修改密码:

mysql -uroot
use mysql;
update user set password=password('123456') where user='root';
flush privileges;

4: 远程授权访问;

授权:
grant all on *.* to 'root'@'%' identified by 'password' with grant option;
//允许账户root从任何主机连接到所有数据库(*.*)
grant all on test.* to 'user'@'%' identified by 'password' with grant option;
//允许账户user从任何主机连接到test数据库(test.*)
flush privileges; //刷新系统授权表

5: 退出

exit ;
原文地址:https://www.cnblogs.com/sanmubird/p/8994679.html