473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

unable to connect to mysql

pc
hi everyone,

I am trying to connect to a new mysql installation. I have given root
permission to connect to all databases from anywhere;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwd' WITH
GRANT OPTION;

I can log on locally by specifying the host name:

[me@au101 me]$ mysql -h 127.0.0.1 -u root -p test
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.18-standard

However, when I try to log in locally without specifying the host name
I receive the following error:

[me@au101 me]$ mysql -u root -p mysql
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)

If I try to connect remotely as root using MySQLyog I receive a similar

error message:

Access denied for user root@[my ip]

Any assistance would be appreciated.

cheers,

eddiec :-)

Feb 2 '06 #1
3 2570
"pc" <ch***@netspace.net.au> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I am trying to connect to a new mysql installation. I have given root
permission to connect to all databases from anywhere;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwd' .... However, when I try to log in locally without specifying the host name
I receive the following error:


Make sure there is not already an entry for 'root' @ 'localhost' in the
`mysql`.`user` table.
Since 'localhost' is more specific than the wildcard entry '%', MySQL's
privilege system will use it instead of the '%' entry you created.

If an entry exists, it likely does not have the same password as the entry
you just created. It may have an empty field for the password, which means
the connection works only when you specify no password.

See also the following pages for more information:
http://dev.mysql.com/doc/refman/5.0/...on-access.html
http://dev.mysql.com/doc/refman/5.0/...ss-denied.html

Regards,
Bill K.
Feb 3 '06 #2
Among the wreckage we found a fragment on which pc had scratched:
I can log on locally by specifying the host name:

[me@au101 me]$ mysql -h 127.0.0.1 -u root -p test Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
connection id is 2 to server version: 5.0.18-standard

However, when I try to log in locally without specifying the host name I
receive the following error:

[me@au101 me]$ mysql -u root -p mysql Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)


In the first case you are connecting through a TCP/IP socket, in the
second you are trying to connect through a unix domain socket. Check that
/var/lib/mysql/mysql.sock actually exists, the permissions allow you to
access it, and that the server is listening to it by doing:

mysqladmin version
Feb 3 '06 #3
pc
hi Bill,

I had:

mysql> select host, user from user;
+--------------+------+
| host | user |
+--------------+------+
| % | % |
| % | root |
| 192.168.1.10 | root |
| fc4 | |
| fc4 | root |
| localhost | |
| localhost | root |
+--------------+------+

in my user table. I deleted everything except for one line:

mysql> select host, user from user;
+------+------+
| host | user |
+------+------+
| % | % |
| % | root |
+------+------+
2 rows in set (0.00 sec)

and can now log on through mysqlyog from my pc!

thanks a lot

eddiec :-)

Feb 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sridhar Reddy | last post by:
Hi, Where can i get the download mysql.sock file? I am unable to connect to local server because i dont have this file? thanx in advance Sridhar
2
by: Mondal | last post by:
Hi, I am using MySQL 5.0 beta and Active Python 2.4. I have the correct version of MySQLdb installed. The problem is that I can't connect to MySQL through the Active Python interactive window. ...
23
cyberking
by: cyberking | last post by:
Hi. I have just started learning PHP along with MySQL. I am trying to connect to the MySQL DB server but unable to. I have been tryin. Please help. Its urgent cos I shall soon have to work on...
12
Rahulnewdelhi
by: Rahulnewdelhi | last post by:
hello all Hello all I installed php, mysql and IIS in xp. Problem is this while i run following file PHP Code: ---------------- <?php
1
by: iceboy | last post by:
Hello to all,I have a problem to connect PHP & MySQL together. I have created a form that gets the username & password from admin and connect him to database.the part of PHP script that connect to...
1
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as...
8
by: malaysiauser | last post by:
Im new user of PHP and MySQL. I tried to use a script package for my web. I'd created a database. And my connection scripts are as follow; <?php $mysql_host="localhost"; ...
5
Markus
by: Markus | last post by:
I'll leave out the annoying 'i'm a newbie' speech and get to the point: i'm a newbie at perl ;) First thing i ever wrote in perl and it doesnt work. I'm using xampp as my localhost - with perl...
10
rhitam30111985
by: rhitam30111985 | last post by:
hi all .. java/jdbc newbie here ... i cant seem to perform the most basic step for database connectivity using java . here is my code : import java.sql.*; public class connect { ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.