I did the following steps to use MySQL in Ubuntu:
sudo aptitude install php5-mysql mysql-server
sudo service mysql stop
sudo mysqld_safe --skip-grant-tables
If you get an error message like this:
Warning: mysql_connect(): Access denied for user: ....
then the problem is that your application can not access the database
. This can have several causes:
First of all, make sure the database settings in your db-config.php
(connection file for your application) are correct, specifically the name
and password
of your MySQL user, the name of your database
, and the name of your MySQL server.
If you're running your own server, you may need to give your MySQL user proper permissions. Log in to MySQL as the MySQL root user and issue these commands:
GRANT ALL PRIVILEGES ON database_name TO user@host IDENTIFIED BY 'password';
FLUSH PRIVILEGES;