How I can set a “root” password in MySQL?


In the \xampp\mysql\bin directory enter into the console:
mysqladmin -u root password secret
Ok, “secret” should be your secret password. Then update the password
for PHPMyAdmin. Open the “config.inc.php” in \xampp\phpmyadmin an edit
following lines:

INSTEAD OF …

$cfg['Servers'][$i]['user']          = 'root';<br />$cfg['Servers'][$i]['password']      = '';<br /></pre>

NOW ...<br />
<pre>$cfg['Servers'][$i]['user']          = 'root';<br />$cfg['Servers'][$i]['password']      = 'secret';<br />
Ads

Set a new ‘root’ passwort with mysqladmin

* How I can set a “root” password in MySQL? (method 2 )

Well,
there is still another possibility to set the root password. Start
PHPMyAdmin with http://127.0.0.1/phpmyadmin, open the database “mysql”
(never delete this!) and use the table “user”. Create here a new user
or e.g. simply change the password of “root.” MySQL restart! After
that, do not forget to change the password in the
“xampp/phpmyadmin/config.inc.php” for PHPMyAdmin.

* How I can set a “root” password in MySQL? (method 3 )

This method based on a suggestion by Ruedi from Basel. With that: Thanks and Grüssli to Switzerland!

Tip: Resetting the password can be make also with the /xampp/mysql/resetroot.bat. After that, the password is empty means “”.

Step 1: Run cmd
C:\ program files \apachefriends\xampp\mysql\bin>mysqld-nt –skip-grant-tables

Step 2: Run cmd
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root flush-privileges password “newpwd”

Step 3: Stopping MySQL
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root -p shutdown
Enter password: ****** (newpwd)

Step 4: Edit the “config.inc.php” for the access of PHPMyAdmin
C:\ program files\apachefriends\xampp\phpmyadmin\config.inc.php
Here search for “root”
‘$cfg[‘Servers’][$i][‘password’] = ‘newpwd’; // MySQL password

Step 5: MySQL restart

source: apachefriends

3 thoughts on “How I can set a “root” password in MySQL?

  1. I truly love your website.. Very nice colors & theme.
    Did you create this website yourself? Please reply back as I’m looking to create my own blog and would love to learn where you got this from or just what the theme is called. Kudos!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s