Changes

Jump to navigation Jump to search

Coral: mysql restore password

6,312 bytes added, 13:38, 12 November 2011
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..."
<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-size:12px">'''''Coral'' :'''&nbsp; [[Coral: mysql intro|MySQL]] | [[Coral: mysql change password|Change password]] | [[Coral: mysql restore password|Restore password]] | [[Coral: mysql console|MySQL Console]] | [[Coral: mysql create delete database|Create delete Database]] | [[Coral: mysql create restricted user|Create Restricted User]] | [[Coral: mysql edit restricted user|Edit Restricted User]]</span></div>

{|style="margin-top:5px;"
|-valign="top"
|
<span style="margin-bottom:5px;font-size:25px;color: #31799F;">MySQL - Restore password</span>

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.

__TOC__

|
{| cellpadding="0" cellspacing="0" style="margin-left:6px;margin-bottom:5px;padding-left:6px;padding-right:6px;font-size:11px;background-color: #FFFFEB;border: 1px solid darkslateblue;"
|-
|colspan="2" style="font-weight:bold;"| UniServer&nbsp;8-Coral
|-
|&nbsp;||[[Coral: Introduction|Home]]
|-
|&nbsp;||[[Coral: start quick start|Quick Start]]
|-
|&nbsp;||[[Coral: general intro|General]]
|-
|&nbsp;||[[Coral: apache intro|Apache]]
|-
|<span style="font-size: 14px;">ยป</span>||[[Coral: mysql intro|MySQL]]
|-
|&nbsp;||[[Coral: php intro|PHP]]
|-
|&nbsp;||[[Coral: msmtp intro|MSMTP]]
|-
|&nbsp;||[[Coral: cron intro|CRON]]
|-
|&nbsp;||[[Coral: dtdns intro|DtDNS]]
|-
|&nbsp;||[[Coral: dbbackup intro|Db Backup]]
|-
|&nbsp;||[[Coral: perl intro|Perl]]
|-
|&nbsp;||[[Coral: index main|Main Index]]
|}

|}
==Restore MySQL root user password using UniController==
{|
|-valign="top"
|
Restore MySQL root user password<br />
From UniController, open the menu:


<span style="padding:6px;background-color:#99FFFF"> Server Configuration > MySQL > Restore Password > MySQL > Change Password </span>


* 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.<br />
|
[[Image:Coral_mysql_restore_root_password.gif]]
|}

'''''[[#top | 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.

{|
|-valign="top"
|
# Start a command window: ('''Start''' > click on '''Run''' > type cmd click '''OK''')
# Type the following lines into the command window:
#* '''cd \'''
#* '''cd C:\UniServer\usr\local\mysql\bin'''
#* '''mysqld1 --skip-grant-tables --user=root'''<br />Note: Do not copy and paste! You must type it in.
# 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 />
<pre>
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
_
</pre>
|}

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

{|
|-valign="top"
|
# Start a command window: (Start > click on Run > type cmd and click OK)
# 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'''
# Finished.

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

'''Note:''' All three user '''root''' accounts have their passwords changed.
|
<pre>
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>

</pre>
|}

'''''[[#top | Top]]'''''
===Kill process and restart===

# Kill the process '''mysqld1''' ([[#Kill MySQL process|see the section above]])
# Close both command windows.
# Edit the file UniServer\uni_con\includes\'''mysql_password''' and replace the existing password with the new root password '''root'''.
# 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'''.
# Start the servers using '''UniController'''
# Run phpMyAdmin. If the '''phpMyAdmin page is displayed''', it confirms the update was '''successful'''.

==Related topics==

[[Coral: mysql console|MySQL Console]].

'''''[[#top | Top]]'''''

----

[[Category: Uniform Server 8-Coral]]

Navigation menu