Delete MySQL
Sudo apt-Get autoremove -- purge mysql-server-5.0
Sudo apt-Get remove mysql-Server
Sudo apt-Get autoremove mysql-Server
Sudo apt-Get remove mysql-common // This is very important
Some of the above are actually redundant.
Clean residual data
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
Install MySQL
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
Delete MySQL
Sudo apt-Get autoremove -- purge mysql-server-5.0
Sudo apt-Get remove mysql-Server
Sudo apt-Get autoremove mysql-Server
Sudo apt-Get remove mysql-common // This is very important
Some of the above are actually redundant.
Clean residual data
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
Install MySQL
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