码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2018-11-25 01:19:23      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:detail   font   new   port   说明   ble   foreign   cdn   err   

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 

 

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

标签:detail   font   new   port   说明   ble   foreign   cdn   err   

原文地址:https://www.cnblogs.com/bfyq/p/10014270.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!