1. Installing MySQL 8 on Centos 7
rpm -qa |grep -i mysql //看自己系统有没有装mysqlwget https://dev.mysql.com/get/mysql80-community-release-e17-1.noarch.rpmrpm -ivh mysql80-community-release-e17-1.noarch.rpmyum install mysql-server
Check that the MySQL installation is successful:
systemclt start mysqldsystemclt status mysqldmysqladmin --version
2. Mysql Login
The first time MySQL starts, it generates an initial password to view the initial password method:
grep -i password /var/log/mysqld.log
- Change root password
vim /etc/my.cnf
Add a line at the end:
skip-grant-tables
: Wq Save and exit
- Restart MySQL Service
systemctl restart mysqld
- Password-free login MySQL
mysql -u root -p
Enter directly without entering the password
- Set the root password to null
mysql> use mysql;mysql> update user set authentication_string=‘‘ where user=‘root‘;mysql> quit
- Skip-grant-tables added before deleting/etc/my.cnf
- Restart MySQL Service
- Log back in to MySQL
mysql -u root -p
or enter directly because the password is empty
- To modify the root password by using alter USER
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘[email protected]‘;// ‘[email protected]‘ 替换成你想设置的密码,太简单会失败。
[Centos 7] MYSQL Installation and login issues