yum install mysql mysql-devel mysql-server

chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start

netstat -tap | grep mysql

It should show a line like this:

[[email protected] named]# netstat -tap | grep mysql
tcp 0 0 *:mysql *:* LISTEN 2470/mysqld
[[email protected] named]#

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword

GRANT ALL ON accounts.* TO ‘root’@’%’;

grant all privileges on accounts.* to [email protected] ;
$ mysql -u root

If a password is required, use the extra switch -p:

$ mysql -u root -p
Enter password:

Now that you are logged in, we create a database:

mysql> create database sabindb;
Query OK, 1 row affected (0.00 sec)

We allow user sabinuser to connect to the server from localhost using the
password sabinpasswd:

mysql> grant usage on *.* to [email protected] identified by
‘sabinpasswd’;
Query OK, 0 rows affected (0.00 sec)

And finally we grant all privileges on the sabin database to this user:

mysql> grant all privileges on sabindb.* to [email protected] ;
Query OK, 0 rows affected (0.00 sec)

And that’s it. You can now check that you can connect to the MySQL server
using this command:

$ mysql -u sabinuser -p’sabinpasswd’ sabindb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

Leave a Reply