After changing the network from nat to bridging mode on the Ubuntu virtual machine, MySQL suddenly fails to start. Update failed. Unable to reinstall. After one day, delete the MySQL directory:
/Var/lib/MySQL
And can be repaired. But all databases are lost. Fortunately, it is the test database.
sudo apt-get cleansudo apt-get autocleansudo apt-get remove --purge mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5sudo apt-get install mysql-server
Sudo apt-Get install mysql-Server
Sudo apt-Get install libmysql ++-Dev
It is automatically started after normal installation.
----------------------------------------------------------------------------------
For more information about how to detach a file, see
1. Delete MySQL
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 are redundant. We recommend that you execute them in sequence.
Clean residual data
Dpkg-L | grep ^ RC | awk '{print $2}' | 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 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:
1 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:
1 sudo/etc/init. d/MySQL restart
3. Enter MySQL
$ Mysql-uroot-P administrator password
Configure the MySQL administrator password:
1 sudo mysqladmin-u Root Password newpassword