gmysql 2011-05-17
操作系统:
RHEL 5.4
下载MySQL 5.1.54:
wget http://mysql.ntu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz -c
下载SphinxSE 1.10-beta:
wget http://sphinxsearch.com/downloads/sphinx-1.10-beta.tar.gz -c
详细操作步骤:
cd ~
tar -xzvf sphinx-1.10-beta.tar.gz
tar -xzvf mysql-5.1.54.tar.gz
mkdir mysql-5.1.54/storage/sphinx
cd mysql-5.1.54/storage/sphinx
cp ~/sphinx-1.10-beta/mysqlse/* ./(将mysqlse目录下面的全部文件拷贝到新建立的sphinx目录下。)
cd ~/mysql-5.1.54
sh BUILD/autorun.sh(缺少这一步,在下面./configure的时候可能会报找不到sphinx plugin的错误。)
./configure --with-plugins=sphinx
make
sudo make install(安装成功)
对MySQL进行一些初始化工作:
sudo -s
chown -R root:mysql /usr/local/mysql
/usr/local/bin/mysql_install_db --dadadir=/usr/local/mysql/var
cp path/to/mysql-5.1.54/support-files/my-medium.cnf /etc/my.cnf
chown -R mysql /usr/local/var
cp path/to/mysql-5.1.54/support-files/mysql.server /etc/init.d/
chmod a+x /etc/init.d/mysql.server
启动MySQL:
/etc/init.d/mysql.server start
成功启动之后,使用mysqladmin修改root密码:
/usr/local/bin/mysqladmin -u root -p password PASSWORD
忘记root口令的解决办法:(附)
1,如果MySQL正在运行,那么使用如下命令杀掉:
killall -TERM mysqld
2,使用如下命令启动MySQL:
/usr/local/bin/mysqld_safe --skip-grant-tables &
3,这时候不需要密码就进入MySQL了:
use mysql;
update user set password=password("PASSWORD") where user="root";
flush privileges;
4,再次杀掉MySQL,然后使用如下命令正常启动:
/etc/init.d/mysql.server start