Rover12421's Blog

The End.

Linux下安装MySQL

用wget下载MySQL 6.0
wget http://dev.mysql.com/get/Downloads/MySQL-6.0/mysql-6.0.7-alpha-linux-i686-glibc23.tar.gz/from/http://mysql.mirror.redwire.net/
解压文件
tar zxvf mysql-6.0.7-alpha-linux-i686-glibc23.tar.gz

建组和用户
groupadd mysql
useradd -g mysql mysql

建立目录
在/usr/local/下建mysql目录
mkdir /usr/local/mysql
复制文件到mysql下
cp mysql-6.0.7-alpha-linux-i686-glibc23/* /usr/local/mysql -R

cd /usr/local/mysql
scripts/mysql_install_db –user=mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .

启动mysql
mysql/bin/mysqld_safe –user=mysql &
修改密码
mysql/bin/mysqladmin -u root password 新密码

登入测试
mysql/bin/mysql -uroot -ppassword
(用root用户登入,密码是password)
-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–
Welcome to the MySQL monitor.¡¡Commands end with ; or g.

Your MySQL connection id is 1 to server version: 6.0.7-standard

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql>
-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-–-—
成功!

设置mysql开机自启动

find / -name mysql.server
如果在
/usr/local/mysql/support-files/mysql.server
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql
然后
chmod +x /etc/rc.d/init.d/mysql
chkconfig –add mysql

Comments