Linux学习 (3) 安装mysql

  《Windows Azure Platform 系列文章目录

  

#UNINSTALL MYSQL PACKAGES
yum remove mysql mysql-server


#ROMOVE MYSQL DIRECTORY
mv /var/lib/mysql /var/lib/mysql_bkup


Installing mysql 5.7 on centos 6

1. download yum repo
    wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

2. install yum repo
    yum -y localinstall mysql57-community-release-el6-7.noarch.rpm

3. verify yum repo
    yum repolist enabled | grep "mysql.*-community.*"

3a. to enable/disable a particular release
# yum-config-manager --disable mysql57-community
# yum-config-manager --enable mysql56-community


4. install 
    yum -y install mysql-community-server
    service mysqld start
    service mysqld status
    mysql --version


5. securing the installation
    grep 'temporary password' /var/log/mysqld.log
    mysql_secure_installation --> follow the prompts
        remove anonymouse users
        disallow root remote login

6. Login mysql -u root -p
7.reset default password
set password for root@localhost = password('123');


8. 检查MySQL是否开机自动启动
chkconfig --list | grep mysqld

9. 设置MySQL开启自动启动
  
chkconfig mysqld on

  
Useful links:
http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html
http://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/
原文地址:https://www.cnblogs.com/threestone/p/14679234.html