Cannot Connect To MySQL - Cannot Find Mysql.sock Phpmyadmin Error #2002 [closed]
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this questionI have been working on a mysql database that I set up with phpmyadmin... I copied the database on my server to a different directory on my mac server so a website I am developing can access it... When I changed the MySQL setting in Server Admin to the new directory location, it could not connect to the database anymore, after I saved and restarted the service. I have rebooted the server as well.
I did not alter any files as I copied them to the directory of my website.
Seeing as that did not work, I put the setting back to the default directory of /var/mysql , then saved & restarted the service.
In the Overview of Server Admin, it states: MySql Service is开发者_如何学C: Shutting Down. I have tried: clicking start MySQL at the bottom (the program is responding), restarting the service, removed and added the service, and changed the permissions of the /var/mysql folder.
When I try to access mysql through phpmyadmin in a web browser, I get: #2002 Cannot log in to the MySQL server.
I figure the MySQL server did not start and is having a problem doing so. From my research on the web I need to verify that mysql.sock exists in the /var/mysql dir.... which it does not. I did a search of my mac and could not find it. I do not wish to reinstall this as I shouldn't have to.
In terminal, I have tried this: mysqladmin restart mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)' Check that mysql is running and that the socket: '/var/mysql/mysql.sock' exists!
Any Ideas?? Everything is up to date as well.
Thanks
Sadly, I just reinstalled mySQL package on that server, and didn't touch phpmyadmin and it worked. Thank you for the input though
MySQL is not running.
Try one of these from the command prompt:
To start mysql server:
/etc/init.d/mysqld start
To stop mysql server:
/etc/init.d/mysqld stop
To restart mysql server:
/etc/init.d/mysqld restart
Also try:
service mysqld restart
You will need to tell MySQL to start automatically if it's always not started.
Failing that - my bet would be to re-install MySQL and MAC's startup/pref thing.
精彩评论