How to Configure MySQL Database Server on Fedora 16

On previous post (Install MySQL) i already shows how to install MySQL server on Fedora 16. MySQL server is a popular choice of database server that can stores and retrieves data for the blog, websites and applications. MySQL is a Relational Database Management System (RDBMS) that runs as a server providing multi-user access to a number of databases. For more information on MySQL, you can visit their website at www.mysql.com. This post will show you how to configure MySQL server on linux Fedora 16 server. This post assumed that you have set up local yum repository using your DVDROM and had installed minimal installation type Fedora 16.

1. How to configure mysql service run at boot on Fedora 16 :
To ensure that the mysql service run automatically at boot, please run this command :

[root@fedora16 ~]# systemctl enable mysqld.service

Example :

[root@fedora16 ~]# systemctl enable mysqld.service
ln -s '/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'

If you run chkconfig command, it will also return the same result as above :

[root@fedora16 ~]# chkconfig --levels 235 mysqld on
Note: Forwarding request to 'systemctl enable mysqld.service'.

or

[root@fedora16 ~]# chkconfig mysqld on
Note: Forwarding request to 'systemctl enable mysqld.service'.

2. How to start mysql service on Fedora 16 :

[root@fedora16 ~]# systemctl start mysqld.service

3. How to stop mysql service on Fedora 16 :

[root@fedora16 ~]# systemctl stop mysqld.service

4. How to restart mysql service on Fedora 16 :

[root@fedora16 ~]# systemctl restart mysqld.service

5. Configure basic security for MySQL server on Fedora 16.
As a root, simply run the following command :

[root@fedora16 ~]# mysql_secure_installation

Above command will perform the following task for you to ensure your MySQL server apply the basic security :
a) Set root password
b) Remove anonymous users
c) Disallow root login remotely
d) Remove test database and access to it
e) Reload privilege tables now

See also  How to Grant Privileges in MySQL Database Server

Examples :

[root@fedora16 ~]# mysql_secure_installation




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):
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] y
New password:
Re-enter new password:
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] y
 ... 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] y
 ... 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] y
 - 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] y
 ... 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!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *