Tuesday, June 30, 2015

Install and Uninstall MySQL Server in Ubuntu LTS 14.04 Terminal

Installing MySQL Server


Here are the quick steps to download and install MySQL Server in Ubuntu through terminal.

step 1 : Installation
OpenUp a terminal and enter the following command.

sudo apt-get install mysql-server

It will install MySQL server and will ask a password during the process.



You can give a refereed password and re-enter it in the next window.

step 2 : Verification
After the above step MySQL should start automatically. To verify that enter the following command.

sudo netstat -tap | grep mysql

it will show the listening port of the Server and so on.



step 3 : Restarting in case

If the Server is not restarting properly restart the server eneringthe following command.

sudo /etc/init.d/mysql restart

Access MySQL Server


You can access the MySQL server through your terminal by entering following command.

mysql -u root -p

After entering your password the terminal switch into mysql> then you can use that interface to create databases and do other database operations.

Uninstall MySQL Server from Ubuntu


At times you may need to reinstall MySQL Server. For that you need complete removing it from the linux system. Enter the following commands one after the other to completely remove the MySQL Server from the system.

sudo apt-get remove --purge mysql-server mysql-client mysql-common

sudo apt-get autoremove

sudo apt-get autoclean

These will remove the MySQL Server Completely from the system. If you have issues still after these steps remove the mysql directory in the lib folder by running following command.

sudo rm -rf /var/lib/mysql

After that if you want to re install MySQL Server you can follow the above mentioned steps again.

Ting! :)


No comments:

Post a Comment