centos 7 安装二进制mysql 详细步骤

1 下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz 复制这个链接在迅雷上下载比较快。

2 上传到centos服务器:scp mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz root@39.105.221.232:/usr/local

3 解压到 /usr/loacl 目录 

4 重命名 mv  mysql-5.7.24-linux-glibc2.12-x86_64 mysql

5 创建 mysql用户和组 

  groupadd mysql 

  useradd mysql -g mysql

6 进入mysql目录 创建data文件夹  mkdir data

7 修改mysql目录的用户权限 chown -R mysql.mysql 

8 进入mysql/bin 目录 执行 ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ 初始化mysql

如果报 ./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory 这个错误,说明没有安装libaio 那么应该去安装libaio

  rpm -qa|grep libaio 检查是否安装若未安装则执行:yum install  libaio-devel.x86_64 安装。安装成功后进入mysql/bin目录再次执行

  ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

  出现以下内容,说明初始化成功。@loaclhost 后面是初始化的登陆密码。

2018-11-24T15:36:01.283846Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-24T15:36:02.649660Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-11-24T15:36:02.765222Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-11-24T15:36:03.044910Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a6970d37-effe-11e8-8e3f-00163e2e8bb3.
2018-11-24T15:36:03.048345Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-11-24T15:36:03.048905Z 1 [Note] A temporary password is generated for root@localhost: JHGFVKHG&#¥

 

9 添加mysql启动到本地服务 cp /usr/local/mysql/mysql.server /etc/init.d/mysql.server

10 启动mysql服务:service mysql.server start

看到 

Starting MySQL.Logging to '/usr/local/mysql/data/iZ2ze2h6biv9bg5169c9gtZ.err'.
[ OK ]

 

就表示启动成功了。

11 设置环境变量,并使环境变量生效

export PATH=$PATH:/usr/local/mysql/bin

12 启动mysql ,密码是初始化使生成的默认密码。到此,完全完成myql的安装。

  mysql -uroot -p 

 

转载于:https://www.cnblogs.com/bfyq/p/10014270.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值