Welcome, Guest. [ Log In ]
Question   Why can't I connect to local MySQL?
Search KBase


Top 5 in this Area:
1. How do I dump data into MySQL?
2. How do I add a new MySQL database?
3. How do I designate a host name for my MySQL database?
4. How do I add users to my database?
5. How do I manage my mysql database?

 
Why can't I connect to local MySQL?
Because, unlike many webhosts, we don't run MySQL on our web servers.. they all run on separate database servers (unless you have your own dedicated server of course).

Therefore, whenever you connect to MySQL, whether it be from the command line or a website, you have to specify the MySQL hostname you chose when creating your database. If you don't specify a hostname, or use "localhost", you'll end up trying connecting to your web server instead of the correct database server, and get an error like "Can't connect to local MySQL server through socket...".

What this means is, any time you see "localhost" in a script's database settings, you must change it to the MySQL hostname you set up (maybe something like mysql.yourdomain.com). Also, anytime you run the mysql command line command, you're going to have to add a -h mysql.yourdomain.com argument to it!

Last updated: Feb 15, 2005.

User Post (2006-01-06 05:29:22 by cowboystyle)
Same Question...

What is the socket path for Ruby on Rails?
User Post (2005-12-18 12:10:42 by cerebel)
Ruby on Rails requires

socket: /path/to/your/mysql.sock

What is the path to the mysql socket?