install mysql

Installed MySQL 5 from RPMs grabbed from mysql.com

MySQL-client-standard-5.0.24-0.rhel4.i386.rpm
MySQL-devel-standard-5.0.24-0.rhel4.i386.rpm
MySQL-server-standard-5.0.24-0.rhel4.i386.rpm
MySQL-shared-standard-5.0.24-0.rhel4.i386.rpm

mysql configuration file
cp /usr/share/doc/MySQL-server-standard-5.0.24/my-small.cnf etc
use the following configuration:
[mysqld]
bind_address = 127.0.0.1

installation path
mysql home is located under /var/lib/mysql

mysqladmin -u root status
shows some stats.

Now we need to tighten it up:

shell> mysql -u root
mysql> DELETE FROM mysql.user WHERE User = ”;
mysql> FLUSH PRIVILEGES;

mysql -u root mysql
mysql>update mysql.user set password = PASSWORD(“whateveritis”) where user = ‘root’;
mysql>FLUSH PRIVILEGES;

or

shell> mysql -u root
mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘newpwd’);
mysql> SET PASSWORD FOR ‘root’@’host_name’ = PASSWORD(‘newpwd’);

or

shell> mysqladmin -u root password “newpwd”
shell> mysqladmin -u root -h host_name password “newpwd”

Add a new user:

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘someuser’@’localhost’
-> IDENTIFIED BY ‘somepass’ WITH GRANT OPTION;

or

mysql> INSERT INTO user
-> VALUES(‘localhost’,’someuser’,PASSWORD(‘somepass’),
-> ‘Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’);

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON somedb.*
-> TO ‘someuser’@’localhost’
-> IDENTIFIED BY ‘somepass’;

Note: if PHP was installed befor MySQL, it will need to be re-compiled…

This entry was posted in server setup. Bookmark the permalink.