Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have worked with MySQL for years but I am stuck on a seemingly trivial problem.

I installed MySQL 5.0.96 on Mac 10.5, created a database, created a user with privileges on everything, and problem:
Apache/PHP (osCommerce) installed on the same machine says:

There was a problem connecting to the database server. The following error had occured:
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
Please verify the connection parameters and try again.

It is my first time installing MySQL on Mac, and there might be a bug with %, so I added for all addresses I could imagine (%, localhost, 127.0.0.1, my IP) but no luck:

mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'monty'@'127.0.0.1' IDENTIFIED BY 'some_pass';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'127.0.0.1' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'monty'@'192.168.43.152' IDENTIFIED BY 'some_pass';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.43.152' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

Default install, I did not change any parameter.
skip_networking is OFF.
The Mac firewall is set to accept anything.

Am I doing something wrong?

share|improve this question

1 Answer 1

I have found the problem:
Somehow, MySQL decided to create mysql.sock in /private/tmp rather than in /var/mysql.

So, my solution was to create a symlink:

cd /var
sudo mkdir mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock

Now everything works fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.