Page 1 of 1

root user for mysql not working

PostPosted: 29. November 2006 16:27
by petschni
Hello,

I have the problem that I just cannot login with the "root" user. Loggin in with the "pma" users works just fine, but even if I execute the "restroot".bat - i won't be able to login.

Does anybody have an idea what I am doing wrong or how this could be solved?

thanks,
peter

Re: root user for mysql not working

PostPosted: 29. November 2006 22:42
by Izzy
petschni wrote:Hello,

I have the problem that I just cannot login with the "root" user. Loggin in with the "pma" users works just fine, but even if I execute the "restroot".bat - i won't be able to login.

Does anybody have an idea what I am doing wrong or how this could be solved?

thanks,
peter

Did you set a password for the root user?

Try and tell us exactly what you have done and what you are trying to do after you did it. It saves time by eliminating lots of questions to get at what you have done etc.

PostPosted: 30. November 2006 11:39
by petschni
I didn't set a password for root.

I just did the normal installation for xampp. The Apache Server is working fine for a couple of months. Now I wanted to use the Mysql Server. So I startet the service and the Server itself. Then I tried to login using phpmyadmin. Login for "pma" works but login for "root" doesn't. So then I reset the password for the root user with the "bat-file". But I was still not able to login.

I hope this is the information you were looking for?

thanks!
peter

PostPosted: 30. November 2006 12:14
by Izzy
If you didn't set a password for root then you don't need one to access phpMyAdmin just enter root and don't put in a password. There was also no need to reset a password you didn't set in the first place.

Did you read the MySQL section in the xampp\readme-en.txt file?

Can you paste here this part of the xampp\phpmyadmin\config.inc.php file. It is round about line 70 onwards. I will try and suggest a suitable configuration that will let you in to phpmyadmin:
Code: Select all
$cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension']     = 'mysql';     // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
                                                    // (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser']   = 'pma';          // MySQL control user settings
                                                    // (this user must have read-only
$cfg['Servers'][$i]['controlpass']   = '';          // access to the "mysql/user"
                                                    // and "mysql/db" tables).
                                                    // The controluser is also
                                                    // used for all relational
                                                    // features (pmadb)
$cfg['Servers'][$i]['auth_type']     = 'cookie';      // Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only
                                                    // this db is displayed in left frame
                                                    // It may also be an array of db-names, where sorting order is relevant.
$cfg['Servers'][$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname


If you don't want to paste the above here then at least make sure that it looks similar to this as the above is a copy of mine and it works perfectly.

Save the file and restart mysql so the changes you made can take effect. Then try and access phpmyadmin using root as user but don't add a password.

Try that and see how you go.

PostPosted: 07. December 2006 20:26
by Scooter7
I am having the same problem. Here is my information from the config.inc.php:

Code: Select all
$cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension']     = 'mysql';     // The php MySQL extension to use ('mysql' or 'mysqli')
$cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
                                                    // (requires PHP >= 4.3.0)
$cfg['Servers'][$i]['controluser']   = 'pma';          // MySQL control user settings
                                                    // (this user must have read-only
$cfg['Servers'][$i]['controlpass']   = '';          // access to the "mysql/user"
                                                    // and "mysql/db" tables).
                                                    // The controluser is also
                                                    // used for all relational
                                                    // features (pmadb)
$cfg['Servers'][$i]['auth_type']     = 'cookie';      // Authentication method (config, http or cookie based)
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
                                                    // with 'config' auth_type)
$cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only
                                                    // this db is displayed in left frame
                                                    // It may also be an array of db-names, where sorting order is relevant.
$cfg['Servers'][$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname

PostPosted: 07. December 2006 23:29
by Izzy
That config looks OK now. (You can change the cookie to http if your cookies are turned off in your browser but don't use config).

Did you restart MySQL after making the changes?

What error message are you getting when you try and access phpMyAdmin?

Is there any clue in the mysql error log?
xampp\mysql\data\(PCusername).err
(drag into your text editor to read this file)

Have you had another instance of MySQL installed before you installed XAMPP?

Do you have my.ini in your Windows directory that contains the user root with a password?

Do you have a my (drag this link file into your text editor to view or edit it's content) or my.cfg in your xampp\mysql\bin directory that contains a root user with a password?

Did you read the xampp\readme_en.txt file * MYSQL NOTES:?

PostPosted: 08. December 2006 04:08
by Scooter7
Yes, I restarted MySQL.

The error message in phpMyAdmin is "Error: Cannot log in to the MySQL server".

There is no clue in (PCusername).err, it just says when I started and stopped the server.

As for having another instance of MySQL, I'm not certain but I think I did.

Do you have my.ini in your Windows directory that contains the user root with a password?


No, all it had in it was "[WinMySQLAdmin]
Server=C:/Program Files/XAMPP/xampp/mysql/bin/mysqld-nt.exe".

Do you have a my (drag this link file into your text editor to view or edit it's content) or my.cfg in your xampp\mysql\bin directory that contains a root user with a password?


No, I have no such files in that directory.

Did you read the xampp\readme_en.txt file * MYSQL NOTES:?


Yes, but I don't know how to use the thing that might fix my problem:

"MySQL starts with standard values for the user id and the password. The preset
user id is "root", the password is "" (= no password). To access MySQL via PHP
with the preset values, you'll have to use the following syntax:
mysql_connect("localhost","root","");
If you want to set a password for MySQL access, please use of mysqladmin.
To set the passwort "secret" for the user "root", type the following:
C:\xampp\mysql\bin\mysqladmin -u root password secret"

Where do I type that? I tried it in my Windows cmd.exe, but all I got was:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

This is what I entered:

C:\Program Files\XAMPP\xampp\MySQL\bin\mysqladmin -u root password secret

PostPosted: 08. December 2006 05:07
by Izzy
Scooter7 wrote:Where do I type that? I tried it in my Windows cmd.exe, but all I got was:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

This is what I entered:

C:\Program Files\XAMPP\xampp\MySQL\bin\mysqladmin -u root password secret


First make sure that mysql is running.

Then at the command prompt in the console window type:
cd C:\Program Files\xampp\xampp\mysql\bin\

Then type your commands

I have found the easiest way to set a mysql password after you have started Apache and MySQL is from:
http://localhost/xampp
(I have not had to use the mysqladmin from the command line - I only look at it from the XAMPP Control Panel as all my database duties are done from within phpMyAdmin. Much easier for me I find).

Select Security from the menu.
Click on http://localhost/security/xamppsecurity.php

Current Password: leave blank
New Password: <type your password here>
Repeat the new password: <type your password here>

Select the http or cookie authentication method.

Tick Safe (should be Save) plain password in text file?
until you have remembered your password then you can uncheck this and delete the file mentioned in the path if you are worried about security on your local PC.

Click on Password Changing

Now go back to the main screen and select phpMyAdmin and enter your
user:root
password:your password

If all is fine then you should be able to access your phpmyadmin and create users and databases at your pleasure.

PostPosted: 08. December 2006 05:17
by Scooter7
Thank you Izzy, that worked! While I'm here I'd just like to thank you guys for creating XAMPP, it's made hosting a LOT easier. :wink:

~Scooter7 8)