shell> groupadd mysql #创建mysql的用户组和用户
shell> useradd -g mysql mysql
shell> cd /server/software/
shell> cp mysql-5.1.22-rc-linux-i686-glibc23.tar.gz /usr/local/
shell> cd /usr/local/
shell> tar -zxvf mysql-5.1.22-rc-linux-i686-glibc23.tar.gz
shell> ln -s mysql-5.1.22-rc-linux-i686-glibc23 mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql #初始化安装mysql数据库
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> cp support-files/mysql.server /etc/init.d/mysql #设置mysql开机自启动
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> /etc/init.d/mysql start
如果这一步骤tar -zxvf mysql-5.1.22-rc-linux-i686-glibc23.tar.gz 失败,可能是下载的包有误,换个mirror重新下载mysql版本安装
如果start过程失败:Starting MySQL.Manager of pid-file quit without updating fi[失败],则执行下面的命令:
shell> rm -rf /var/lib/mysql
然后重新执行下面步骤:
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> cp support-files/mysql.server /etc/init.d/mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> /etc/init.d/mysql start #启动mysql
设置mysql密码为123456:
shell> /usr/local/mysql/bin/mysqladmin -u root password '123456'
设置mysql开机自启动:
shell> vi /etc/rc.d/rc.local
添加下面内容:
/usr/local/mysql/bin/mysqld_safe --user=mysql&
登陆mysql:
shell> /usr/local/mysql/bin/mysql -uroot -p123456
43万+

被折叠的 条评论
为什么被折叠?



