Connecting to MySQL

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Connecting to MySQL

Postby bradkoch2007 » 20. July 2006 01:27

I'm a begginer with MySQL and have no experience with it. I've worked with XAMPP's FileZilla and Apache services quite a bit, but I'm having trouble connecting to MySQL. I am attempting to connect with the defaults in the XAMPP Readme, which are host='localhost', user='root', and password='' (blank). However, whenever I try to connect, I get the message "Access denied for user 'root'@'localhost' (using password: NO)". I've also tried 127.0.0.1 instead of localhost with no success. I've tried reseting the root password with the resetroot.bat file in the /xampp/mysql/ directory, again with no success. If someone could please help me figure out what's wrong I would really appreciate it.
bradkoch2007
 
Posts: 3
Joined: 19. July 2006 22:56

Postby Izzy » 20. July 2006 06:05

Is the mysql daemon running (mysqld.exe)?
Check using the Task Manager in XP if that is your OS.
Right click on the TaskBar and select Task Manager.
Click on the Image Name column to get the list in alphabetical order (easier to find a process).
Look for mysqld.exe.
If not there start mysqld.exe by using the XAMPP Control Panel (easiest) or run mysql_start.bat from a command prompt.

Go to the XAMPP Admin page and select phpMyAdmin to see if you can connect via phpMyAdmin (the db config editor). It will already have the servers databases set up for you to look at. Don't edit them unless you understand what you are doing. You can create your own databases or check that your web apps have done their job when you are setting them up (like phpBB, PostNuke etc).

The next step, if you can access phpMyAdmin, is to select Security in the Admin page and go through the motions of setting a mySQL password. An open mySQL service is a huge security risk.

From within the Control Panel you can set up mySQL and the other (apache, FTP and Mail) to run as XP Services. Then all XAMPP services can be run when you boot. You can also run the Admin pages from within the CP.
HTH :)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby bradkoch2007 » 20. July 2006 17:14

I went into the task manager to make sure the mysql daemon was running. mysqld.exe was not present, but mysqld-nt.exe was. The xampp control panel reported that mysql was running. I ran the mysql_start.bat file in the xampp directory and mysqld.exe appeared in the task list and mysqld-nt.exe disappeared. The xampp control panel now says that mysql is not running. When I attempt a connection, I get the same exact message I got previously, "Access denied for user 'root'@'localhost' (using password: NO)". If it's denying access, then that should mean that mysql is running, correct? But why am I being denied access when I am using the root user with the default password even after I try reseting the password?
bradkoch2007
 
Posts: 3
Joined: 19. July 2006 22:56

Postby Izzy » 21. July 2006 03:13

bradkoch2007 wrote:I went into the task manager to make sure the mysql daemon was running. mysqld.exe was not present, but mysqld-nt.exe was...
mysqld.exe is the non XP Service version of mySQL and mysqld-nt.exe is the XP Service version selectable in the XAMPP Control Panel. For most things I use the XAMPP Control Panel and only go manual if I need to fix or solve problems with the server or its parts.

Now we have established you have mySQL running the next step is to investigate the 'access denied' error message.

Open xampp/phpmyadmin/config.inc.php in your fav. text editor and find the following entry, which is the default settings as used with an XAMPP install:
Code: Select all
$cfg['Servers'][$i]['auth_type']     = 'config';    // 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)


As you can see you need to enter a password if the Authentication method used is 'config'

I remember having some issues like you have at the moment until I changed the Authentication method to 'cookie' as in the below code which is what I use at the moment and which is the method that best works for me:
Code: Select all
$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)

So, you need to change the Authentication method to another method other than 'config' or enter your root password in the required field (between the ' ' as in 'password') if you use the 'config' Authentication method.

As a side note here, when I tried entering my root password in the 'config' authentication method the error message changed from:
"Access denied for user 'root'@'localhost' (using password: NO)"
To:
"Access denied for user 'root'@'localhost' (using password: YES)"
Thats when I plumped for the 'cookie' Authentication method which has worked ever since. :)

You may have to stop then restart mysql for the changes to be recognised.

This hopefully will solve the access denied issue. :)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

success

Postby bradkoch2007 » 22. July 2006 02:13

I tried what you suggested, but it didn't work for me. I asked a friend who's been helping me with this if he had any suggestions. He came up with the idea to launch mysqld.exe from command prompt with --skip-grant-tables so that the authentication was skipped. I then logged in with a GUI, SQLyog, and used the administration tools to change the root password. I then restarted MySQL and was able to log in successfully. Not quite sure what using the GUI to change the root password did, but MySQL is working now. Thanks anyways for helping me out through this!
bradkoch2007
 
Posts: 3
Joined: 19. July 2006 22:56


Return to XAMPP for Windows

Who is online

Users browsing this forum: JJ_Tagy and 66 guests