mysql installation notes
Make sure mysql and mysql-server are installed:
-----------------------------------------------
[root@bouncer tmp]# rpm -qa|egrep -i sql
libdbi-dbd-mysql-0.6.5-9
mysql-3.23.58-13
mod_auth_mysql-20030510-5
php-mysql-4.3.9-3
mysql-bench-3.23.58-13
mysql-server-3.23.58-13
MySQL-python-0.9.2-4
perl-DBD-MySQL-2.9003-5
mysql-devel-3.23.58-13
Run mysql for the first time:
-----------------------------
[root@bouncer tmp]# /etc/rc.d/init.d/mysqld start
Initializing MySQL database: [ OK ]
Starting MySQL: [ OK ]
Verify mysql server is online:
------------------------------
[root@bouncer tmp]# /usr/bin/mysqladmin status
Remove anonymous access to mysql:
---------------------------------
shell> mysql -u root
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;
Set password for user 'root':
-----------------------------
First, find out what the machines hostname is:
mysql> SELECT Host, User FROM mysql.user;
+-------------------------+------+
| Host | User |
+-------------------------+------+
| bouncer.ourbabyhome.com | root |
| localhost | root |
+-------------------------+------+
2 rows in set (0.01 sec)
(hostname is bouncer.ourbabyhome.com)
To assign passwords to the root accounts using mysqladmin, execute the following commands:
shell> mysqladmin -u root password "newpwd"
shell> mysqladmin -u root -h host_name password "newpwd"
eg.
# mysqladmin -u root password "mypass"
# mysqladmin -u root -h bouncer.ourbabyhome.com password "mypass"
Check like so:
mysql> SELECT Host, User,Password FROM mysql.user;
+-------------------------+------+------------------+
| Host | User | Password |
+-------------------------+------+------------------+
| localhost | root | 137245292607ad59 |
| bouncer.ourbabyhome.com | root | 137245292607ad59 |
+-------------------------+------+------------------+
2 rows in set (0.00 sec)
===
Grant a user access to a database:
CREATE DATABASE mydatabase;
GRANT ALL ON mydatabase.* TO fred@localhost IDENTIFIED BY "mypass"
grant all on bouncer.* TO donn@localhost IDENTIFIED by "mypass";
grant all on bouncer.* TO donn@bouncer.ourbabyhome.com IDENTIFIED by "mypass";
0 Comments:
Post a Comment
<< Home