Coral: mysql change password

From The Uniform Server Wiki
Jump to navigation Jump to search

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.

UniServer 8-Coral
  Home
  Quick Start
  General
  Apache
» MySQL
  PHP
  MSMTP
  CRON
  DtDNS
  Db Backup
  Perl
  Main Index

Set New MySQL root user password using UniController

Change or set a new MySQL root user password.
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
  • B) Click the Change Password button.

The change process is automatic; the indicators show the actions taken.

Top

Set New MySQL root user password using phpMyAdmin

Setting a new MySQL root password using phpMyAdmin requires four 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:

  1. From the top menu bar of phpMyAdmin, click the Privileges (1) button. The user privileges page opens, as shown on right:
  2. 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 (6) repeat password (7)
    • Click Go (8) to unpdate the user's password
  3. Repeat step 2) for each remaining user (3), (4) and (5)
  4. 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.

  1. Edit file UniServer\uni_con\includes\mysql_password and replace the existing password (root12) with the new root password (root123).
  2. 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.

Top

Set New MySQL root user password using MySQL Console

Setting a new MySQL root password using MySQL Console requires four 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:

  1. Connect to MySQL server by typing the following at the command window:
    mysql -uroot -proot123
  2. At the MySQL prompt type the following:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root1234');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('root1234');
mysql> SET PASSWORD FOR 'root'@'::1'       = PASSWORD('root1234');
mysql> SET PASSWORD FOR 'pma'@'localhost'  = PASSWORD('root1234');
mysql> FLUSH PRIVILEGES;
mysql> exit;

Results for steps 1) and 2) are shown on right.

  1. Edit file UniServer\uni_con\includes\mysql_password and replace the existing password (root123) with the new root password (root1234).
  2. 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 -uroot -proot123
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root1234');
Query OK, 0 rows affected (0.03 sec)
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('root1234');
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'root'@'::1'       = PASSWORD('root1234');
Query OK, 0 rows affected (0.00 sec)
mysql> SET PASSWORD FOR 'pma'@'localhost'  = PASSWORD('root1234');
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.06 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.


Top