Centos 6.9 mysql installation configuration

1. New system, install mysql

yum -y install mysql mysql-server mysql-devel

2. Start mysql

service mysqld start

3. Change the password

Log in
mysql -uroot

Select the database named mysql
use mysql;

Change the password of all users named root
update user set password=password('123456') where user='root';

quit
exit;

Login with new password
mysql -uroot -p

4. Modify remote access permissions

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
FLUSH PRIVILEGES;

5. iptables open port

iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

service iptables save

service iptables restart

6. Set startup

chkconfig mysqld on

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324870206&siteId=291194637