Coral: mysql restore password

From The Uniform Server Wiki
Revision as of 13:38, 12 November 2011 by Ric (talk | contribs) (Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MySQL - Restore password

There are two methods for restoring the MySQL root password: by a command window or UniController. The better method is to use UniController which is fully automated. The other method requires running two command windows and a certain amount of typing and editing.

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

Restore MySQL root user password using UniController

Restore MySQL root user password
From UniController, open the menu:


Server Configuration > MySQL > Restore Password > MySQL > Change Password


  • The Restore MySQL Password menu opens (See image on right)
  • Click the Run Restore button.

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

Coral mysql restore root password.gif

Top

Restore MySQL root user password using command window

To restore the MySQL root user password, the MySQL server requires restarting with "skip grant tables" option set. This bypasses any security, allowing access to the server. A new password is set and the grant tables updated. The following method uses two command windows and task manger.

Kill MySQL process

If the MySQL server is running, the process must first be stopped. Open windows task manager by pressing ctrl, alt and del keys together. In the window that opens, click on the Process tab (default); scroll up or down and locate the file mysqld1.exe. Right click on this and select End Process; click Yes to confirm kill process.


Note: If you have run multi-servers, the process name will differ. For example, mysqldX.exe, where X is a digit. Kill this process

Restart MySQL server skip grant

The MySQL server requires restarting from a command window with "skip grant tables" option set as follows:

Note: The path you installed The Uniform Server may be different; substitute your path as appropriate.

  1. Start a command window: (Start > click on Run > type cmd click OK)
  2. Type the following lines into the command window:
    • cd \
    • cd C:\UniServer\usr\local\mysql\bin
    • mysqld1 --skip-grant-tables --user=root
      Note: Do not copy and paste! You must type it in.
  3. A flashing cursor indicates the server is running. Minimise this window (do not close it).

The dialogue in the command window looks similar to this:<r />

C:\Documents and Settings\mike>cd \
C:\> cd C:\UniServer\usr\local\mysql\bin
C:\UniServer\usr\local\mysql\bin>mysqld1 --skip-grant-tables --user=root
_

Set Password and Update grant tables

Start a second command window to set a new password (root) and update grant tables as follows:

  1. Start a command window: (Start > click on Run > type cmd and click OK)
  2. Type following lines into the command window:
    • cd \
    • cd C:\UniServer\usr\local\mysql\bin
    • mysql
    • USE mysql;
    • UPDATE user SET password=password("root") WHERE user="root";
    • UPDATE user SET password=password("root") WHERE user="pma";
    • flush privileges;
    • exit
  3. Finished.

The dialogue in the command window looks similar to that on the right.

Note: All three user root accounts have their passwords changed.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\mike>cd \
C:\>cd C:\UniServer\usr\local\mysql\bin
C:\UniServer\usr\local\mysql\bin>mysql

mysql> USE mysql;
Database changed
mysql> UPDATE user SET password=password("root") WHERE user="root";
Query OK, 3 rows affected (0.50 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> UPDATE user SET password=password("root") WHERE user="pma";
Query OK, 3 rows affected (0.50 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.86 sec)

mysql> exit;
Bye

C:\UniServer\usr\local\mysql\bin>

Top

Kill process and restart

  1. Kill the process mysqld1 (see the section above)
  2. Close both command windows.
  3. Edit the file UniServer\uni_con\includes\mysql_password and replace the existing password with the new root password root.
  4. Edit the file UniServer\uni_con\config_tracker.ini
    • Navigate to section: [MYSQL]
    • Change line password = xxx by replacing the existing password xxx with the new root password root.
  5. Start the servers using UniController
  6. Run phpMyAdmin. If the phpMyAdmin page is displayed, it confirms the update was successful.

Related topics

MySQL Console.

Top