1. First you need to login as root.
sudo su
2. Next you need to update and upgrade apt.
apt-get update apt-get upgrade
3. To install MySQL, run the following command:
apt-get install mysql-server
4. During the installation process you will be prompted to enter a password for the MySQL root user.
Once the installation is complete, the MySQL server should be started automatically.
You can run the following command from a terminal prompt to check whether the MySQL server is running:
$sudo netstat -tap | grep mysql
To start mysql server:
/etc/init.d/mysqld start
To stop mysql server:
/etc/init.d/mysqld stop
To restart mysql server:
/etc/init.d/mysqld restart
To change MySQL Password, run the following command:
mysqladmin -u root password NEWPASSWORD
change “NEWPASSWORD” with your own password.