标签:表示 -name socket rem schedule 授权 提示 install option
1、先查看是否有安装mysql,有的话通过yum remove mysql先卸载掉,卸载完成后执行
yum install -y mysql-server mysql mysql-deve
2、启动mysql服务
service mysqld start //也可以通过/etc/init.d/mysqld start启动
3、设置为开机自启动
chkconfig mysqld on
4、设置root账号的密码
mysqladmin -u root password ‘newpass‘
如果上面这种设置密码的方式失败还可以尝试通过如下方式设置
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD(‘newpass‘) WHERE user = ‘root‘;
mysql> FLUSH PRIVILEGES;
5、为远程客户端连接授权
mysql -u root –p //会提示输入密码,输入上面设置的root新密码
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘newpass‘ WITH GRANT OPTION //*.*表示不对连接的ip做限制
6、对my.cnf中的配置进行设置(文件一般在/etc/my.cnf)
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock security risks symbolic-links=0 max_connections = 1000 default-character-set=utf8 max_allowed_packet = 16M skip-name-resolve event_scheduler = on
7、重启mysql服务
/etc/init.d/mysqld restart
标签:表示 -name socket rem schedule 授权 提示 install option
原文地址:http://www.cnblogs.com/luobiao320/p/7183745.html