Still Reading Commercial Emails For Free? Receive Emails On Topics That Interests You And Get Paid For It! Get $10 Just to signup! Click Here

Custom Search

Friday, October 10, 2008

Setup MySQL Root Password

·

You can assign passwords to the root accounts in 3 ways.

·Use the SET PASSWORD statement

·Use the mysqladmin command-line client program

·Use the UPDATE statement

To assign passwords using SET PASSWORD, connect to the server as root and issue two SET

PASSWORD statements. Be sure to encrypt the password using the PASSWORD() function.

For Windows, do this:

shell> mysql -u root

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');

For Unix, do this:

shell> mysql -u root

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');

mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

In the second SET PASSWORD statement, replace host_name with the name of the server host. This

is the same hostname that you used when you assigned the anonymous account passwords.

To assign passwords to the root accounts using mysqladmin, execute the following commands:

shell> mysqladmin -u root password "newpwd"

shell> mysqladmin -u root -h host_name password "newpwd"

These commands apply both to Windows and to Unix. In the second command, replace host_name

with the name of the server host. You can also use UPDATE to modify the user table directly. The

following UPDATE statement assigns a password to both root accounts at once:

shell> mysql -u root

mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')

-> WHERE User = 'root';

mysql> FLUSH PRIVILEGES;

The UPDATE statement applies both to Windows and to Unix.

For example, if you want to use mysqladmin to shut down the server, you can do so using this

command:

shell> mysqladmin -u root -p shutdown

Enter password: (enter root password here)

0 comments:

Travel Packages

Travel package in malaysia as low as USD29.00
Packages: Langkasuka Hotel
Duration: Per Night
Location:Langkawi
80% of 90,000 Hotels worldwide available at lowest price guaranteed!
Join viewmalaysia.com now! langkasuka