Install mysql on centos linux

Install mysql on centos linux

Reference : https://blog.eduguru.in/linux-2/install-lamp-server-apache-mysql-php-on-rhel-centos-scientific-linux-6-56-4

Install MySQL

MySQL is an enterprise class, open source, world’s second most used database. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack.

To install MySQL, enter the following command:

 

# yum install mysql mysql-server -y

Start the MySQL service and make to start automatically on every reboot.

 

1
2
# service mysqld start
# chkconfig mysqld on

Setup MySQL root password

By default, mysql root user doesn’t has password. To secure mysql, we have to setup mysql root user password.

 

1
# mysql_secure_installation

Follow the next instruction as follow:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user.  If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):     <span style=”color: #ff0000;”>## Press Enter ##</span>
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n]     <span style=”color: #ff0000;”>## Press Enter ##
</span>New password:                <span style=”color: #ff0000;”>## Enter new password ##
</span>Re-enter new password:       <span style=”color: #ff0000;”>## Re-enter new password ##
</span>Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]     <span style=”color: #ff0000;”>## Press Enter ##
</span> … Success!
Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]     <span style=”color: #ff0000;”>## Press Enter ##</span>
… Success!
By default, MySQL comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n]     <span style=”color: #ff0000;”>## Press Enter ##
</span> – Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n]     <span style=”color: #ff0000;”>## Press Enter ##
</span> … Success!
Cleaning up…
All done!  If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Now all done!!!