Difference between revisions of "Configuring basic MariaDB server"

From Notes_Wiki
m
m
Line 33: Line 33:


By defauly mysql root user has no password (empty password) which is not very secure. To setup root password for mysql use '<tt>/usr/bin/mysql_secure_installation</tt>' script. This script will ask for current root password which is blank and then will ask for new root password twice. It will also ask a number of other queries. Answer 'Y' (default) for all other queries.
By defauly mysql root user has no password (empty password) which is not very secure. To setup root password for mysql use '<tt>/usr/bin/mysql_secure_installation</tt>' script. This script will ask for current root password which is blank and then will ask for new root password twice. It will also ask a number of other queries. Answer 'Y' (default) for all other queries.
==Configuring application specific username, password and database==
Many different applications can use MySQL database in parallel. In order to ensure isolation among such applications a different MySQL database with separate set of user credentials can be created for each application. To create a application specific MySQL database, corresponding user and password use:
#Login into mysql as root using '<tt>mysql -u root -p</tt>'
#Create database using '<tt>create database &lt;database-name&gt;;</tt>'
#Create user with permissions and passwords using
#:<pre>
#::grant all on &lt;database-name&gt;.* to &lt;username&gt;@localhost identified by '&lt;password&gt;';
#:</pre>
#Reload privilege table using '<tt>flush privileges;</tt>'




<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>
<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>

Revision as of 05:31, 18 January 2013

<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>

Configuring basic MySQL server

Installation

To install mysql server use:

yum -y install mysql-server


Configuration

Starting mysql server

To start mysql server use:

service mysqld start


Enabling on start-up

To configure mysql server such that it automatically runs on system boot use:

chkconfig mysqld on


Setting root password

By defauly mysql root user has no password (empty password) which is not very secure. To setup root password for mysql use '/usr/bin/mysql_secure_installation' script. This script will ask for current root password which is blank and then will ask for new root password twice. It will also ask a number of other queries. Answer 'Y' (default) for all other queries.


Configuring application specific username, password and database

Many different applications can use MySQL database in parallel. In order to ensure isolation among such applications a different MySQL database with separate set of user credentials can be created for each application. To create a application specific MySQL database, corresponding user and password use:

  1. Login into mysql as root using 'mysql -u root -p'
  2. Create database using 'create database <database-name>;'
  3. Create user with permissions and passwords using
    grant all on <database-name>.* to <username>@localhost identified by '<password>';
  4. Reload privilege table using 'flush privileges;'


<yambe:breadcrumb>Mysql configuration</yambe:breadcrumb>