MySQL - Change password
There are three methods of changing the MySQL root password: by a command window, phpMyAdmin or UniController. The easiest method is to use UniController, which is fully automated. The other methods require a certain amount of typing and editing, and are more error-prone.
Set New MySQL root user password using UniController
From UniController open the menu:
Server Configuration > MySQL > Change Password
- The Set New MySQL Password menu opens (See image on right)
- A) Enter a new password. For example, root12
- B) Click the Change Password button.
The change process is automatic; the indicators show the actions taken.
|
|
Set New MySQL root user password using phpMyAdmin
Setting a new MySQL root password using phpMyAdmin requires two root accounts to be changed along with two configuration files.
Note: The following assumes the current password is root12 and the new password is root123; substitute for these as appropriate.
First start both servers using UniController and then start phpMyAdmin to change the password. Proceed as follows:
- From the top menu bar of phpMyAdmin, click the Privileges (1) button. The user privileges page opens, as shown on right:
- Click the first Edit Privileges (2) which opens a new page: "Edit Privileges: User"
- Scroll down the page to Change password
- Enter new root password; for example root123 (4) repeat password (5)
- Click Go (6) to unpdate the user's password
- Repeat step 2) for the remaining user (3)
- Navigate to the end of the Privileges User Overview page and click reload the privileges link.
Note: Do not stop the MySQL server at this point.
|
|
- Edit file UniServer\uni_con\includes\mysql_password and replace the existing password (root12) with the new root password (root123).
- Edit file UniServer\uni_con\config_tracker.ini
Navigate to section: [MYSQL]
Change line password = root12 by replacing the existing password root12 with the new root password root123.
Note: Perform a quick test. Clear your browser's cache and restart the servers. Run phpMyAdmin and verify that the MySQL server is accessible.
|
|
Note: The above root user accounts all use the same root password. This is purely for convenience and one of consistency.
Set New MySQL root user password using MySQL Console
Setting a new MySQL root password using MySQL Console requires two root accounts to be changed along with two configuration files.
Note: The following assumes the current password is root123 and the new password is root1234; substitute for these as appropriate.
First start both servers using UniController and then start MySQL Console to change the password. Proceed as follows:
- Connect to MySQL server by typing the following at the command window:
mysql -h127.0.0.1 -uroot -proot123
- At the MySQL prompt type the following:
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('root1234');
mysql> SET PASSWORD FOR 'pma'@'127.0.0.1' = PASSWORD('root1234');
mysql> FLUSH PRIVILEGES;
mysql> exit;
Results for steps 1) and 2) are shown on right.
- Edit file UniServer\uni_con\includes\mysql_password and replace the existing password (root123) with the new root password (root1234).
- Edit file UniServer\uni_con\config_tracker.ini
Navigate to section: [MYSQL]
Change line password = root123 by replacing the existing password root123 with the new root password root1234.
|
C:\UniServer\usr\local\mysql\bin>mysql -h127.0.0.1 -uroot -proot123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('root1234');
Query OK, 0 rows affected (0.11 sec)
mysql> SET PASSWORD FOR 'pma'@'127.0.0.1' = PASSWORD('root1234');
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.44 sec)
mysql> exit
Bye
C:\UniServer\usr\local\mysql\bin>
|
Note: Perform a quick test. Clear your browser's cache and restart the servers. Run phpMyAdmin and verify that the MySQL server is accessible.
Related topics
Restore MySQL root password.
MySQL Console.
|