分类: Mysql/postgreSQL
2012-02-16 14:50:41
解压移动
tar -zxvf mysql-5.5.15-linux2.6-i686.tar.gz
mv mysql-5.5.15-linux2.6-i686 mysql5
mv mysql5 /usr/local/
安装
cd /usr/local/mysql5/
useradd mysql
scripts/mysql_install_db --user=mysql
chown -R root:mysql .
chgrp -R mysql .
chown -R mysql.mysql data
cp support-files/my-huge.cnf /etc/my5.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysql5
chmod 755 /etc/rc.d/init.d/mysql5
修改配置文件
vi /etc/rc.d/init.d/mysql5
basedir=/usr/local/mysql5
datadir=/usr/local/mysql5/data
conf=/etc/my5.cnf
$bindir/mysqld_safe --defaults-file=/etc/my5.cnf --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
bindir=/usr/local/mysql5/bin
datadir=/usr/local/mysql5/data
basedir=/usr/local/mysql5
并且修改其他这个文件下/usr/local/mysql 为/usr/local/mysql5
和/use/local/mysql5/bin/mysqld_safe 这个文件的/usr/local/mysql 为/usr/local/mysql5
vi /etc/my5.cnf
[client]
#password = your_password
port = 3305
socket = /tmp/mysql5.sock
[mysqld]
port = 3305
socket = /tmp/mysql5.sock
连接数据库:
mysql -u root -p -S /tmp/mysql5.sock
要用PHPmyadmin连接,修改/usr/local/apache/htdocs/phpMyadmin/libraries/config.default.php文件
$cfg['Servers'][$i]['port'] = '3305';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql5.sock';