How to install MySql on CentOS server
Please check whether MySql packages are available under yum.
yum list mysql*
If yes, then install mysql using below command.
yum install mysql*
Now install the Mysql database on the server using below command.
mysql_install_db
It will create mysql database on mysql server. Now, we have to reset the password for the Mysql server root user. Please use below command.
/usr/bin/mysqladmin -u root password ‘new-password’
Replace the ‘new-password’ with the password you would like to set.
Now, create my.cnf under root home directory using below command.
vi /root/.my.cnf
Now, insert the below lines in .my.cnf file
[client]
user=”root”
password=”new-password”
Please replace the “new-password” with the password you have used above while setting up with the mysqladmin command.
Your Mysql server is now installed and configured on your machine. You can check the same using below command.
mysql
Try start Mysql service using the below command:
service mysql start
Comments are closed.