Mysql安装教程
1.change root user
su
2.install mysql yum repository
## Fedora 24 ##
dnf install https://dev.mysql.com/get/mysql57-community-release-fc24-8.noarch.rpm
## CentOS 7 and Red Hat (RHEL) 7 ##
yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
3.update or install mysql
## Fedora 24/23/22
dnf install mysql-community-server
## Fedora 21, CentOS 7.2/6.8/5.11 and Red Hat (RHEL) 7.2/6.8/5.11
yum install mysql-community-server
3.start mysql server and autostart mysql on boot
## Fedora 24/23/22 and CentOS 7.2
systemctl start mysqld.service ## use restart after update
systemctl enable mysqld.service
## CentOS 6.8/5.11 and Red Hat (RHEL) 6.8/5.11
/etc/init.d/mysql start ## use restart after update
## OR ##
service mysql start ## use restart after update
chkconfig --levels 235 mysqld on
5.get your generated random root password
grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1
## Example Output:
2015-11-20T21:11:44.229891Z 1 [Note] A temporary password is generated for root@localhost: -et)QoL4MLid
6.login mysql
mysql -u password -p et)QoL4MLid
7.change validate_password_policy
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
8.change password again!
mysql> alter user 'root'@'localhost' identified by '123';