To install MySQL, run the following command at a terminal prompt:
Sudo apt-Get install mysql-Server
Sudo apt-Get install mysql-Client
Sudo apt-Get install php5-mysql
// Installing the php5-mysql is to connect PHP and MySQL
Once the installation is complete, the MySQL server should be started automatically. You can run the following command at a terminal prompt to check whether the MySQL server is running:
Sudo netstat-tap | grep MySQL
When you run this command, you can see a line similar to the following:
TCP 0 0 localhost. localdomain: MySQL *: * listen-
If the server cannot run properly, run the following command to start it:
Sudo/etc/init. d/MySQL restart
Go to MySQL
$ Mysql-uroot-P administrator password
Configure the MySQL administrator password:
Sudo mysqladmin-u Root Password newpassword
Http://wiki.ubuntu.org.cn/MySQL%E5% AE %89%E8%A3%85%E6%8C%87%E5%8D%97