by Seal (Haibo Yu)2008-7-20

1>将mysql安装文件(本人使用mysql5.0.51a-linux-i686-glibc23.tar.gz)解压到对应目录,在此为 /home/seal/mysql

2>进入源码目录编译安装

CODE:

#cd /home/seal/mysql
#./configure –prefix=/usr/local/mysql –with-charset=gbk |注:配置Mysql安装路径并且支持中文
#make |注:编译
#make install |注:编译安装

3>替换/etc/my.cnf文件,进入源码包,执行命令

CODE:

#cd /home/seal/mysql
#cp support-files/my-medium.cnf /etc/my.cnf

4>建立MySQL使用者和群组:

CODE:

#groupadd mysql
#useradd -g mysql mysql

5>完成以上操作以后进行初始化数据库,进入已经安装好的mysql目录

CODE:

#cd /usr/local/mysql
#bin/mysql_install_db –user=mysql |注:–user=mysql 初始化表并且规定用mysql用户
6>设置给mysql和root用户设定访问权限 我们先进入mysql目录

CODE:

#cd /usr/local/mysql
#chown -R root /usr/local/mysql |注:设定root能访问/usr/local/mysq
#chown -R mysql /usr/local/mysql/var |注:设定mysql用户能访问/usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql |注:设定mysql组能够访问/usr/local/mysq
7>启动mysql,进入已经安装好的目录

CODE:

#cd /usr/local/mysql
#bin/mysqld_safe –user=mysql &

8>
修改mysql数据库超级用户root的缺省密码:
/usr/local/mysql/bin/mysqladmin -u root password ‘mysql’

关闭mysql服务器
cd /usr/local/mysql/bin
./mysqladmin -u root -p shutdown

9>设定开机就启动mysql,进入源码目录下</p>

# cd /home/seal/mysql
# cp support-files/mysql.server /etc/init.d/mysql

# chmod +x /etc/init.d/mysql
# chkconfig –level 345 mysql on
# service mysql restart
Shutting down MySQL. [ 确定 ]
Starting MySQL [ 确定 ]
[root@localhost mysql]#
10>设置Mysql远程访问:<br />
在启动mysql后:
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WI
TH GRANT OPTION;
mysql>Flush Privileges;

安装完毕。<br />

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注