After mysql version 5.6, the default root password is no longer provided for login. If you want to modify the mysql root user password after version 5.6, please refer to the following steps:
Official download address of version 5.7.11:
http://dev.mysql.com/downloads/mysql /
After decompression, install in rpm mode. When
installing , pay attention to relying on the
/etc/my.cnf file to store the mysql installation settings, where datadir indicates the mysql data file path
datadir=/var/lib/mysql
-- Use non-safe mode to initialize mysql
# mysqld --initialize -insecure --user=mysql
When initializing, you may encounter the following
error2016-03-18T16:24:04.688033Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2016-03- 18T16:24:04.688073Z 0 [ERROR] The
reason for Aborting is that the data file is not empty, and the mysql data file needs to be cleared. The data file path is the directory pointed to by the above /etc/my.cnf file datadir.
# cd /var/lib/mysql
# rm -rf *
reinitialize again
# mysqld --initialize-insecure --user=mysql
start mysql service
# service mysqld start
-- log in as root user, ignore password
# mysql -u root --skip-password
-- change root password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
-- use root user Login
# mysql -u root -p
Enter password: use the new set password
to this mysql root user password initialization is complete
-- mysql service start, stop, restart commands
# service mysqld start
# service mysqld stop
# service mysqld restart
rhel7 initialize mysql 5.7 root password
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327037889&siteId=291194637
Recommended
Ranking