“Centos: config mysql server”版本间的差异
来自cslt Wiki
(以“1. install mysql server on centos a) wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm b) sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm...”为内容创建页面) |
|||
| 第2行: | 第2行: | ||
a) wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm | a) wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm | ||
b) sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm | b) sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm | ||
| − | c) yum update | + | c) yum install mysql-community-server |
| + | d) service mysqld restart | ||
| + | |||
| + | 2. set password for 'root' | ||
| + | a) # mysql -u root | ||
| + | b) mysql> use mysql; | ||
| + | c) mysql> update user set password=PASSWORD(‘your_password’) where User='root'; | ||
| + | |||
| + | 3. add new user | ||
| + | a) mysql> select host,user from user; | ||
| + | |||
| + | |||
| + | 5. allow firewall accept port 3306 | ||
| + | a) # firewall-cmd --add-service=mysql --permanent | ||
| + | success | ||
| + | b) # firewall-cmd --reload | ||
| + | success | ||
| + | c) iptables -L -n | grep 3306 (check whether port 3306 is accept) | ||
| + | ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306 ctstate NEW | ||
2016年11月1日 (二) 07:50的版本
1. install mysql server on centos
a) wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm b) sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm c) yum install mysql-community-server d) service mysqld restart
2. set password for 'root'
a) # mysql -u root b) mysql> use mysql; c) mysql> update user set password=PASSWORD(‘your_password’) where User='root';
3. add new user
a) mysql> select host,user from user;
5. allow firewall accept port 3306
a) # firewall-cmd --add-service=mysql --permanent
success
b) # firewall-cmd --reload
success
c) iptables -L -n | grep 3306 (check whether port 3306 is accept)
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306 ctstate NEW