centos下安装mysql5.1步骤

mysql linux安装步骤:

1. make a directory, e.g,
cd /usr/local
mkdir mysql
2. cd /usr/local/mysql, then download from mysql.org,
you should select a compiled version,e.g http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.30-linux-x86_64-glibc23.tar.gz

e.g,

wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.30-linux-x86_64-glibc23.tar.gz

3. extract from compress file: tar -xzvf mysql-5.1.30-linux-x86_64-glibc23.tar.gz
4. rename mysql-5.1.30-linux-x86_64-glibc23 to your name, e.g, mv mysql-5.1.30-linux-x86_64-glibc23 run

5. begin to install step by step:

   5.1. cd run
   5.2. groupadd mysql # add a user who run mysqld
   5.3. useradd -g mysql mysql
   5.4. scripts/mysql_install_db --user=mysql #初始化权限
   5.5. chown -R root  . #更改当前目录得所有权
   5.6. chown -R mysql data
   5.7. chgrp -R mysql .
   5.8. 运行mysql服务, bin/mysqld_safe --user=mysql &
   5.9. 初始root没有密码,需要登录后,更改密码、配置用户
   5.10. bin/mysql -u root
   5.11. DELETE FROM mysql.user WHERE User = ''; #删除匿名用户
   5.12. select Host,User,Password from mysql.user; #查看当前用户
   5.13. SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
         SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('123456'); #配置用户密码
   5.14. 开启远程客户端使用root访问权限: GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 

   5.15. FLUSH PRIVILEGES; #刷新权限

   5.16. ps aux|grep mysqld, 找到mysqld进程 id, kill -15 【pid】
   5.17. cp support-files/my-large.cnf /etc/my.cnf
   5.18. vi /etc/my.cnf, then try to find [mysqld], add "user=mysql" and "basedir=/usr/local/mysql/run", then save
   5.19 cp support-files/mysql.server /etc/init.d/mysql
   5.20. cd /etc/rc.d/init.d
   5.21. chmod +x mysql
   5.22. /sbin/chkconfig --del mysql
         /sbin/chkconfig --add mysql # 保证能开机启动
   5.23 ./mysql start

all is ok!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值