I'm installing on a Mac, system 10.4.9, running mysql 5.0.41. I've created a database named "drupal", using MySQLAdministrator. It has no tables at the moment. I've given write permission on the settings.php file. I have the Drupal "Database Configuration" screen showing on the browser. I've given it the name of the database, the root user, and the password, all of which works on MySQLAdministrator. It gives the error message "Failure to connect to MySQL server".
I suspect I'm supposed to tell it where the database is -- "localhost" -- but don't know the syntax to do this.
What am I missing? Where should I have found it by myself so I didn't have to bother you folks with it? My thanks in advance to anyone who takes the time to reply.
Comments
Make sure MySQL isrt up and
Make sure MySQL isrt up and running. Installing the MySQL Panel puts it into System Preferences and there you can launch MySQL comfortably. From the error message I'd suppose MySQL server is not running on your box... There's no need to tell Drupal 5 where the database sits if on the same machine. It just works -- installed everything on my iBook yesterday following the manual line by line with a hitch.
Norbert
-- form follows function
Thanks. No, MySQL is
Thanks. No, MySQL is running fine. I have MySQLAdministrator running, and when I click on "Service", it says "Server is running".
Maybe check setting.php
open settings.php and scroll down to the Database URL:
Mine reads:
$db_url = 'mysql:://root@localhost/test';
My database is test. The user is root. And there is not password.
MYSQL connect
See if you can connect manually:
Also, make sure that you have PHP configured with MySQL:
phpinfo();Configuring MySQL on MAC
Hi,
I'm not sure if you changed $db_url in settings.php (around line 90 or so), but the format is
$db_url = 'mysql://username:password@localhost/databasename';
If you still have a problem, you can take a look at http://drupal.org/node/22625 which has an article on Installing Drupal on Mac OS X 10.4 Tiger. Under the comments for Installing and Configuring MySQL, it mentions a problem similar to the one you are having and how to fix it. Here is some of what it said:
"I followed the Instructions above religiously but kept getting an error suggesting I had the wrong username and password in settings.php and the MySQL error was somehting like 'MySQL Error: Could not connect to MySQL on socket /var/mysql/mysql.sock. I was using MySQL-5.0.21 and the php 4.4.1 that was already on my Tiger machine. I figured out that changing the hostname in the $db_url variable in settings.php to 127.0.0.1 instead of localhost worked. Finally I found a better solution here: http://docs.info.apple.com/article.html?artnum=301457. The problem is that when connecting as localhost, php uses a unix domain socket instead of a TCP/IP, but PHP is looking for the socket file created by MySQL in the wrong place. PHP assumes /var/mysql/mysql.sock, but MySQL-5.0.21 was using /tmp/mysql.sock. So following instruction in the above URL (only their example changes the socket file to exactly the opposite of what I needed) I created the php.ini file and edited the the default socket to this:
mysql.default_socket = /tmp/mysql.sock
Then restart apache to make the change take effect:
sudo apachectl restart"
You can take a look at the entire article for more details.
Also, I'm running Drupal on a Mac running Tiger, but instead of using the Apache, PHP, and MySQL that came on my Mac, I downloaded MAMP, which is a Mac package of Apache, MySQL, and PHP that runs as an application in the Applications folder, and I installed Drupal in the htdocs folder of MAMP.
Hope this help,
Mark
Many thanks to all of you.
Many thanks to all of you. Success! Mark, the socket was indeed the problem.