Home >Database >Mysql Tutorial >Detailed step-by-step introduction to changing the password of mysql database
This article brings you the detailed steps on changing the password of the MySQL database. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Recently I was looking at database-related things. After reinstalling the computer, the previous configuration was gone. In order to facilitate the direct configuration of the XAMPP one-click installation package, I encountered the following small problems during the configuration process. . Although the problem is not big, I still want to record it so that I don’t know how to deal with the same problem in the future.
1. Apache shutdown unexpectedly startup error
The error displayed when xampp starts is:
9:52:41 [Apache] Attempting to start Apache app...
9:52:41 [Apache] Status change detected: running
9:52:42 [Apache] Status change detected: stopped
9:52:42 [Apache] Error: Apache shutdown unexpectedly.
9:52:42 [Apache] This may be due to a blocked port, missing dependencies,
9:52:42 [Apache] improper privileges, a crash, or a shutdown by another method.
9: 52:42 [Apache] Check the "/xampp/apache/logs/error.log" file
9:52:42 [Apache] and the Windows Event Viewer for more clues
This is more common The problem of ports 80 and 443 being occupied is as follows:
(1) Port 443 is occupied:
Configure in /xampp/apache/conf/extra/httpd-ssl.conf Change listen 443 to 444 in the file (this port can be defined by yourself)
(2) Port 80 is occupied, apache cannot listen to port 80
In /xampp/apache/conf/extra/ httpd.conf Change Listen 80 to 88 (customizable); if vhosts is configured, please change the port in httpd-vhosts.conf to 88 (the same port number as above)
Link description
2. phpmyadmin access denied
The error when phpmyadmin access is denied is:
phpMyAdmin tried to connect to the MySQL server, but the server refused the connection. You should check the host, username, and password in the configuration file and confirm that the information matches the information given by the MySQL server administrator.
Cause of the error:
The root password in mysql.user was modified, which resulted in inconsistency with the password in the phpMyAdmin configuration file, so the connection could not be made.
Solution:
Modify $$cfg['Servers'][$i]['password']='yourpassword'; // set above for root in ../phpMyAdmin/config.inc.php Password
3. Mysql changes the initial password
(1) Win R and enter cmd to enter the cmd command prompt, enter mysql -uroot -p
(2) If "mysql is not an internal or external command, nor an operable program or batch file" appears at this time, it means that the mysql configuration path is not placed under the environment variable. You need to put the path containing the mysql.exe and mysqld.exe files under the system environment variable;
(3) Enter the database password. If the login is successful, the following display will appear:
(4) After successful login, enter show databases; you can see all databases
(5) Enter use mysql; select the mysql database, which is where the user name is saved
(6) show tables to view all tables, you will find that there are A user table, which stores account information such as user names, passwords, permissions, etc.
(7) Enter select user,host,password from user; to view account information.
(8) To change the root password, enter update user set password=password('123456') where user='root' and host=' localhost';
(9) Check the account information again, select user,host,password from user; You can see that the password has been modified.
(10) Exit the command line, restart the mysql database, and try to log in with a new password.
This completes the modification of the mysql database. The above are some minor problems encountered when configuring mysql. I will record them here.
This article ends here. For more knowledge about MySQL, you can pay attention to the MySQL Tutorial column on the php Chinese website! ! !
The above is the detailed content of Detailed step-by-step introduction to changing the password of mysql database. For more information, please follow other related articles on the PHP Chinese website!