Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2004, 03:46 PM
Authorized User
 
Join Date: Jul 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't connect to mySql server using localhost

According to the mySql manual, you should set a password for all users and remove the row in the mysql.user table that has
Host=’localhost’ and User = ''. You’re also supposed to add a password for the root user. I followed these instructions but now can’t logon:

C:\> C:\mysql\bin\mysql mysql
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
mysql> QUIT
C:\> C:\mysql\bin\mysqladmin reload
C:\> C:\mysql\bin\mysqladmin -u root password your_password
************************************************** ***********
I am logging on to my laptop and according to the mySql documentation (3.1 Connecting to and disconnecting from the Server) I should only need a hostname if the server runs on a machine other than the one where I log on. However, I’m getting the error message below.

C:\mysql\bin>mysql -u root -p
Enter password: *********

ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)

How can I resolve this? FYI, the operating system is Windows NT.

Also, according to the mySql documentation (Connector/ODBC with VB – ADO, DAO, and RDO) in the connection string you should specify a username and password. Will any username and password that has been granted privileges be sufficient or is there supposed to be one username and password for a particular database?

Robin




 
Old April 7th, 2004, 04:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can configure user accounts to only have access to specific databases. I don't know why you're getting an access denied message -- did you properly add a root account, verify the password, and allow it to connect from localhost?


Take care,

Nik
http://www.bigaction.org/
 
Old April 8th, 2004, 01:35 PM
Authorized User
 
Join Date: Jul 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This problem was resolved by re-installing mysql, executing the following commands in the Command Prompt, and turning the machine off and then back on!

Robin
***************

C:\> C:\mysql\bin\mysql mysql
mysql> DELETE FROM user WHERE Host='localhost' AND User='';
mysql> QUIT
C:\> C:\mysql\bin\mysqladmin reload
C:\> C:\mysql\bin\mysqladmin -u root password your_password
C:\> mysqladmin --user=root --password=your_password shutdown



:)

 
Old January 30th, 2006, 10:07 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have a similar problem. BUT

I can connect just fine using the command prompt and I get the error when using PHP/IIS.



Any ideas???






Similar Threads
Thread Thread Starter Forum Replies Last Post
How vb.net connect to the MySQL server database? cwliong2508 VB.NET 0 May 29th, 2006 07:58 PM
I can't connect to remote MySQL server pmnghi MySQL 2 January 24th, 2006 06:38 AM
Can't connect to local MySQL server through socket Salieri MySQL 2 September 14th, 2005 03:06 PM
Can't connect to local MySQL server through socket Salieri BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 July 19th, 2005 02:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.