Linux ubuntu12.04 Uninstall and install mysql

  

Uninstall mysql

First step
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)


Step 2: clean up residual data 1 dpkg -l | Grep ^rc| Awk '{print $2}' | Sudo xargs dpkg -P

Step 3: Install mysql


1 sudo apt-get install mysql-server 2 sudo apt-get install mysql-client 3 sudo apt-get install php5-mysql (Installing php5-mysql connects php and mysql)


Once the installation is complete, the MySQL server should start automatically. You can check if 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 is not working properly To run, you can start it with the following command:
1 sudo /etc/init.d/mysql restart Step 4: Configure the administrator password

Enter mysql


1 $mysql - Uroot -p administrator password

Configure MySQL administrator password:
1 sudo mysqladmin -u root password newpassword

Copyright © Windows knowledge All Rights Reserved