1.检查当前环境是否已安装MySQL
rpm -qa | grep mysql
2.安装MySQL
yum install -y mysql-server
3.启动MySQL服务
service mysqld start
4.设置MySQL管理员用户的密码
mysqladmin -u root password ‘123456‘
5.设置mysqld开机启动
chkconfig mysqld on
6.登录mysql
mysql -u root -p
7.设置用户访问权限
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
8.删除原有的权限
delete from user where host=‘127.0.0.1‘;
9.刷新权限
flush privileges;
10.重启MySQL服务
service mysqld restart
时间: 2024-10-13 23:49:44