table of Contents
Handle dependencies of mysql-libs
View the default password of the MySQL database
Modify the password to enter the MySQL database
Refresh system permissions of MySQL database
Refresh system permissions of MySQL database
Modify the passwords of all users in the MySQL database
Refresh system permissions of MySQL database
Description
MySQL four rpm decompression package versions:
MySQL-client-5.6.45-1.el7.x86_64.rpm
MySQL-devel-5.6.45-1.el7.x86_64.rpm
MySQL-server-5.6.45-1.el7.x86_64.rpm
MySQL-shared-compat-5.6.45-1.el7.x86_64.rpm
The location where the MySQL four rpm decompression packages are stored:
/opt/soft
Virtual machine software selection configuration:
Server with GUI
CPU name
shi1 shi2 shi3
Handle dependencies of mysql-libs
yum remove mysql-libs
Install MySQL database
Enter the following four decompression commands in sequence
rpm -ivh MySQL-server-5.6.45-1.el7.x86_64.rpm
rpm -ivh MySQL-client-5.6.45-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.45-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.45-1.el7.x86_64.rpm
Start MySQL
service mysql start
View the default password of the MySQL database
cat /root/.mysql_secret
Enter MySQL database
The following code is the code to enter the MySQL database, but don’t copy and paste all of it, because p5MS_F9OPHZQRzTW is the default password generated when you install MySQL, and it is different every time you install it. Note that the default password you just viewed is filled in here
In addition, let me talk about the mysql -u -p code. The root behind -u is the root user, and the password behind -p is the password to enter the MySQL database.
mysql -uroot -pp5MS_F9OPHZQRzTW
Modify the password to enter the MySQL database
The default password is too cumbersome, so let's change it to a simple one, which is convenient for entering the MySQL database next time
Pay attention to change the new Chinese password below to the English or numeric password you want to change
set password for 'root'@'localhost'=password('新密码');
Refresh system permissions of MySQL database
Every time you authorize, you must refresh the permissions
flush privileges;
Authorize any user
grant all privileges on *.*to'root'@'%'identified by 'root';
Refresh system permissions of MySQL database
Modify the passwords of all users in the MySQL database
The following command in the 'root' @ 'shi1' in shi1 is the host name of my virtual machines
grant all privileges on *.*to'root'@'shi1'identified by 'root' with grant option;
Refresh system permissions of MySQL database
Exit the MySQL database
Any one of the following three commands can exit the MySQL database
exit;
quit;
\q;