Home Download Ubuntu

How to install MySQL on Ubuntu

1.Update your repositories (if you haven't done it yet):
sudo apt-get update


2.Install it:
apt-get install mysql-client-5.0 mysql-server-5.0 libmysqlclient15-dev


mysql_install_db


3.Start MySQL at system start-up:
rc-update add mysql default


4.Start MySQL server:
/etc/init.d/mysql start


5.Remove the anonymous accounts that are allready there:
mysql -u root>
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;


6.You have to setup password for the user root:
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');


Replace the password between the two single quotes with a password of your choice. You will need this password later!
Replace 'host_name' with the IP address of the computer mysql is running on or your domain name.
Keep in mind that the MySQL server does'nt have to be on the same machine, but for latency issues, MySQL server should be located in LAN.

Make mysql run with php5:

sudo apt-get install php5-mysql mysql-client


Then you need to edit php.ini and add to it this line, if it isn't already there

extensions=mysql.so


The php.ini file should be located

sudo nano /etc/php5/apache2/php.ini


Now restart Apache

sudo /etc/init.d/apache2 restart

0 comments:

Post a Comment