MySQL on CentOS

  1. 云栖社区>
  2. 博客>
  3. 正文

MySQL on CentOS

bndy.net 2018-05-11 15:00:59 浏览1197
展开阅读全文

Introduce how to operate MySQL on CentOS.

Installation

  1. wget rpm from http://dev.mysql.com/downloads/repo/yum/.
  2. Install release package (Example):

    sudo rpm -Uvh mysql80-community-release-el6-n.noarch.rpm
  3. Select Version

    yum repolist all | grep mysql  
    sudo yum-config-manager --disable mysql80-community  
    sudo yum-config-manager --enable mysql57-community  
    yum repolist enabled | grep mysql  
  4. Install & Config MySQL

    sudo yum install mysql-community-server  
    sudo systemctl start mysqld.service  
    sudo systemctl enable mysqld.service   // as service at start  
    sudo grep 'temporary password' /var/log/mysqld.log  
    mysql -uroot -p  
    MYSQL > ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword!';  

Remote Access

SQL

UPDATE user SET Host='%' WHERE User='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Firewall

firewall-cmd --add-port=3306/tcp
firewall-cmd --permanent --add-port=3306/tcp

MISC

https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

网友评论

登录后评论
0/500
评论
bndy.net
+ 关注