mysql安装

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值