Showing posts with label rhel5. Show all posts
Showing posts with label rhel5. Show all posts

Friday, October 19, 2012

How to configure MySQL 5.1 on RedHat Linux


Download required MySQL rpm packages
MySQL-client-community-5.1.25-0.rhel5.i386.rpm
MySQL-server-community-5.1.25-0.rhel5.i386.rpm
MySQL-devel-community-5.1.25-0.rhel5.i386.rpm


Install the downloaded MySQL rpm packages
rpm -ivh MySQL-server-community-5.1.25-0.rhel5.i386.rpm MySQL-client-community-5.1.25-0.rhel5.i386.rpm

Set the root password
/usr/bin/mysqladmin -u root password 'root123'

How to stop and start MySQL
service mysql status
service mysql stop
service mysql start


# /sbin/service mysqld restart


Log into MySQL
mysql -u root -p


How to check the MySQL version
SHOW VARIABLES LIKE "%version%";

How to create a database and granting permission
CREATE DATABASE test;

GRANT ALL ON test.* TO user1@'%' IDENTIFIED BY "user123";


How to drop a database and user
DROP DATABASE test;

SELECT host, user, password FROM mysql.user;

DROP USER 'user1'@'localhost';
or
DROP USER 'user1'@'%';