MYSQL5.7.17版本的安装步骤

发布时间:2021-08-20 19:52:21 作者:chen
来源:亿速云 阅读:259

本篇内容主要讲解“MYSQL5.7.17版本的安装步骤”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“MYSQL5.7.17版本的安装步骤”吧!

MYSQL 5.7.17 安装:

官网下载mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz

解压mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz

tar -xvzf mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz

将解压的安装文件拷贝到安装目录(可自定义)

[root@VMOS01 mysql]# cp -r mysql-advanced-5.7.17-linux-glibc2.5-x86_64 /usr/local/

[root@VMOS01 mysql]# cd /usr/local

[root@VMOS01 local]# mv mysql-advanced-5.7.17-linux-glibc2.5-x86_64 mysql-5.7.17

[root@VMOS01 local]# ln -s mysql-5.7.17 mysql

[root@VMOS01 local]# ln -s /usr/local/mysql/bin/mysql  /usr/bin/mysql

[root@VMOS01 local]# useradd -r -M -u 496 -s /sbin/nologin mysql

将软件、目录赋权给运行用户mysql:

[root@VMOS01 local]# chown -R mysql.mysql /usr/local/mysql-5.7.17/

[root@VMOS01 local]# chown -R mysql.mysql /usr/local/mysql

[root@VMOS01 local]# chgrp -R mysql /usr/local/mysql-5.7.17/

[root@VMOS01 local]# cd /usr/local/mysql

[root@VMOS01 bin]# cd ..

[root@VMOS01 mysql]# ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

2017-04-09 22:38:11 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize

2017-04-09 22:38:20 [WARNING] The bootstrap log isn't empty:

2017-04-09 22:38:20 [WARNING] 2017-04-10T05:38:12.530858Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

mysql5.7新特性:由上面可以看出, mysql_install_db 已经不再推荐使用了,建议改成 mysqld --initialize 完成实例初始化。

[root@VMOS01 mysql]# ./bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/  --initialize

2017-04-10T06:12:09.706181Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-04-10T06:12:11.269373Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-04-10T06:12:11.496771Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-04-10T06:12:11.564642Z 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: a27f16b1-1db4-11e7-b5f3-000c2993673d.

2017-04-10T06:12:11.566539Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2017-04-10T06:12:12.196832Z 0 [Warning] CA certificate ca.pem is self signed.

2017-04-10T06:12:12.439938Z 1 [Note] A temporary password is generated for root@localhost: S8t6ikvw<t1E 【记住初始密码】

[root@VMOS01 support-files]# ./mysql.server start

Starting MySQL SUCCESS!

***

[root@VMOS01 support-files]# cp -v mysql.server /etc/init.d

`mysql.server' -> `/etc/init.d/mysql.server'

[root@VMOS01 support-files]# cd /etc/init.d

[root@VMOS01 init.d]# chkconfig --add mysql.server

[root@VMOS01 init.d]# service mysql.server status

SUCCESS! MySQL running (33215)

[root@VMOS01 init.d]# service mysql.server stop

Shutting down MySQL.. SUCCESS!

[root@VMOS01 init.d]# service mysql.server start

Starting MySQL. SUCCESS!

编辑my.cnf 让本地命令行登陆管理mysql, 不会提示找不到mysql.sock文件错误:

[root@VMOS01 mysql]# more /etc/my.cnf

[client]

socket=/var/lib/mysql/mysql.sock

[root@VMOS01 init.d]# mysql -uroot -p

Enter password: 【输入初始DB的密码】

**************************

第一次登陆mysql,需要更改root@localhost密码,否则会出现如下错误:

[root@VMOS01 support-files]# mysql -ur0ot -p

Enter password:

mysql> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user root@localhost identified by "Root15()";

mysql> show databases;

+--------------------+

| Database               |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

至此mysql 5.7.17安装完成。

到此,相信大家对“MYSQL5.7.17版本的安装步骤”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

推荐阅读:
  1. mysql5.7.17安装配置
  2. redis(版本redis-5.0.2)的安装步骤

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql

上一篇:spring中bean的继承与自动装配的用法

下一篇:javascript函数的节流和防抖是什么意思

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》