MySQL Installation
How to install MySQL in Ubuntu?
- Open your terminal and type the bellow command
#sudo apt-get install mysql-server
- It will ask for your password, Type your ubuntu password and press enter key, it will ask for confirmation
- Type y and press enter key
- During the installation you will be prompted for a password. Choose a secure and type the password and press enter. It will also ask to re enter password
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
When you run this command, you should see the following line or something similar:
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -
If the server is not running correctly, you can type the following command to start it:
sudo /etc/init.d/mysql restart
Overall Process to install MySQL
To install MySql database:
sudo apt-get install mysql-server
# To start MySql server:
/etc/init.d/mysql start
# To stop MySql server:
/etc/init.d/mysql stop
# To restart MySql server:
/etc/init.d/mysql restart
# To check the status of MySql server:
/etc/init.d/mysql status