My Blog

August 20, 2008

MySql installation on Linux

Filed under: Mysql — by enotebook @ 3:16 pm

Information about Host & MySql as belows:
# uname -a
Linux localhost.localdomain 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:00:54 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 5.0.51a-log
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> select version();
| version() |
| 5.0.51a-log |
1 row in set (0.00 sec)

Install Mysql using RPM
rpm -ivh rpmfile (you will encounter error like the mysql package conflicts since it has been installed when you installing OS, use rpm -e to uninstalled them and try again)
default Installation location:
1、data folder
2、configuration files
/usr/share/mysql(mysql.server etc.)
3、binary file
/usr/bin(mysqladmin mysqldump etc.)
4、booting scripts

Install Mysql using distributed file
1. create folder and grant proper permission
# mkdir -p /u01/CfgFiles
# chown -R mysql /u01/
# chgrp -R mysql /u01/

2. transfer file(mysql-5.0.51a-linux-i686.tar.gz) to linux host

3. unzip
# tar -xf mysql-5.0.51a-linux-i686.tar
# mv mysql-5.0.51a-linux-i686 MySql
# ls
app lost+found MySql mysql-5.0.51a-linux-i686.tar oradata

4. copy my-large.cnf & mysql.server to a specific location and moodify them accordingly
# cd MySql/
# cp support-files/my-large.cnf support-files/mysql.server /u01/CfgFiles/
# cd /u01/CfgFiles/
# mv my-large.cnf my.cnf
# mv mysql.server mysqld
# vi mysqld
1). specify the location path to basedir&datadir in line number 46:
46 basedir=/u01/MySql
47 datadir=/u01/MySql/data
2). specify the configuration file in line number 195:
195 #conf=/etc/my.cnf
196 conf=/u01/CfgFiles/my.cnf
# vi my.cnf
1). specify the location path for socket file in line number 20 & 28:
20 #socket = /tmp/mysql.sock
21 socket =/u01/MySql/mysql.sock
28 #socket = /tmp/mysql.sock
29 socket =/u01/MySql/mysql.sock

5. startup Mysql
# ./mysqld start
Starting MySQL [ OK ]
6. Modify password for root:
# mysqladmin -u root password ‘newpassword’

7. Enable remote login:
mysql> grant all on *.* to [email=root@’%’]root@’%’ identified by ‘password’;



Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: