Set up MYSQL server

Standard

Install the RPMs for mysql and mysql-server manually or with YUM or similar. Some dependencies may have to be fulfilled.

Start MySQL with:

service mysqld start

Make sure it starts on reboot:

chkconfig –level 3 mysqld on

First time root login to mysql only.
———————————–

1. First time mysql login (no mysql root password set yet):

$ mysql -uroot
Welcome to the MySQL monitor.
mysql>

2. Set your system wide mysql root password. Change the xxxxxx to your
password. Be careful to keep the quotemarks around the word root and
your xxxxxx:

mysql> use mysql;
Database changed
mysql> update user set password=password(‘xxxxxx’) where user=’root’;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0

3. Finish:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
$

Setting up a mysql database for a user
======================================

Note. There is a very popular administration tool called phpMyAdmin at
http://www.phpmyadmin.net

Login to mysql and add an accout and a new database.
—————————————————

1. Login to mysql with your mysql root password:
Note. If this fails, maybe this is a first time login. See below.

$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.
mysql>

2.Uae the administration database:
mysql> use mysql;
Database changed

3. Add a user called XXXXX with password YYYYY (keep all the quotemarks):

mysql> insert into user (host, user, password) values(‘localhost’, ‘XXXXX’,
password(‘YYYYY’));
Query OK, 1 row affected (0.04 sec)

4. Create a database for XXXXX called WWWWW:
mysql> create database WWWWW;
Query OK, 1 row affected (0.01 sec)

5. Allow user XXXXX to administer the database called WWWWW:

mysql> grant all privileges on WWWWW.* to ‘XXXXX’;
Query OK, 0 rows affected (0.02 sec)

6. Tell mysql to update the mysql users and exit:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
$

++++++++++++++++++++++++

you are now ready to use your new MySQL data base and server.


Disclaimer:
By reading and/or using the information within this web page you agree to hold the author, publisher and all related entities harmless from any claim directly or indirectly related to the information given or the use of any part of the information on this web site. Use at own risk. No responsibility taken.