- 1 sudo apt-get autoremove--purge mysql-server-5.0
- 2 sudo apt-get remove mysql-server
- 3 sudo apt-get autoremove mysql-server
- 4 sudo apt-get remove Mysql-common (very important)
In fact, some of the above is redundant, it is recommended to follow the order
Clean up residual data
- Dpkg-l |grep ^rc|awk ' {print $} ' |sudo Xargs dpkg-p
2. Install MySQL
- 1 sudo apt-get install Mysql-server
- 2 sudo apt-get install mysql-client
- 3 sudo apt-get install php5-mysql (Installation Php5-mysql connects PHP to MySQL)
Once the installation is complete, the MySQL server should start automatically. You can check whether the MySQL server is running by running the following command at the terminal prompt:
- 1 sudo netstat-tap | grep MySQL
When you run the command, you can see a line similar to the following:
TCP 0 0 Localhost.localdomain:mysql *:* LISTEN-
If the server does not function correctly, you can start it by using the following command:
- Sudo/etc/init.d/mysql restart
3. Enter MySQL
$mysql-uroot-p Administrator Password
Configure the Administrator password for MySQL:
- sudo mysqladmin-u root password newpassword
- Then re-refresh under Permissions: Flush privileges;
Ubuntu Delete MySQL (go)