将mysql 安装在单个Linux系统主机,并配置本地或远程(此处可仅单指局域状态下的环境)的无主机登录。谨记的是:操作完mysql 设置时,需以flush privileges进行权限刷新。小编亲测在mysql 数据库变成“砖头”而无法登录时,此法有效!

1.安装MySQL

yum install mysql-server   安装mysql-server服务端
service mysqld start       启动mysql服务
chkconfig mysqld on        设置mysql服务开机自启
chkconfig --list mysqld    查看mysql服务开机自启情况

2.数据库无主机配置
show databases;
use mysql
show tables;
select host,user from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;
delete from user where host !='%';
flush privileges;
quit



mysql -u root -p
quit