How to install MySQL in Linux

Home > Search > How-to
  by

Use apt-get or yum to install the MySQL server. Be careful to observe if MySQL or MariaDB is installed. Some distributions will actually install MariaDB instead of MySQL.

[root@server1 ~]# apt-get install mysql-server
[root@server1 ~]# yum install mysql

 

Add the MySQL Authentication library modules to Apache:

[root@server1 ~]# apt-get install libapache2-mod-auth-mysql

 

Install the following package if your website will be using PHP:

[root@server1 ~]# apt-get install php5-mysql

 

Optional:

[root@server1 ~]# mysql_install_db/usr/bin/

 

Secure MySQL:

[root@server1 ~]# mysql_secure_installation

 

After install, ensure MySQL is active and running.

[root@server1 ~]# systemctl status mysql

 

Use systemctl to enable MySQL, which ensure MySQL will automatically be active after a reboot.

[root@server1 ~]# systemctl enable mysql

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments