mysql5.7.20:安装教程
从mysql官网下载安装包:/mysql-5.7.20-linuxglibc2.12-x86_64.tar.gz
#切换目录
cd /usr/local
#解压下载的安装包
tar -zxvf /software/mysql/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
#重命名
mv mysql-5.7.20-linux-glibc2.12-x86_64 mysql
#建立数据存储目录
mkdir data
#建立用户组
groupadd mysql
#建立用户,并禁止用户登录
useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql
#改变文件归属
chown -R mysql.mysql /usr/local/mysql/
#初始化系统数据库,记住不能用./bin/mysql_install_db,已经过期了
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
初始化后,会打印日志,如下 ,注意看最后输出,红色标记部分,这个就是root的临时密码。
2018-01-12T05:08:12.048923Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see doc umentation for more details).
2018-01-12T05:08:12.228535Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-01-12T05:08:12.251370Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-01-12T05:08:12.305856Z 0 [Warning] No existing UUID has been found, so we a ssume that this is the first time that this server has been started. Generating a new UUID: 968b7130-f756-11e7-8704-000c29009e57.
2018-01-12T05:08:12.306388Z 0 [Warning] Gtid table is not ready to be used. Tabl e 'mysql.gtid_executed' cannot be opened.
2018-01-12T05:08:12.307188Z 1 [Note] A temporary password is generated for root@localhost: LwchxXdoO5*8
配置数据库:
vi /etc/my.cnf
my.cnf内容:
[mysqld]
#目录设置
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306 #服务ID
socket=/tmp/mysql.sock #数据库表名大小写不敏感
lower_case_table_names=1 #设置字符集,防止中文乱码
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
安装成服务:
cp -a ./support-files/mysql.server /etc/init.d/mysqld
启动服务
service mysqld start
登录到mysql
./bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> grant all privileges on *.* to root@"%" identified by "2018dlj123!@#0112" with grant option;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
一开始想做授权,结果发现报错,原因是必须要修改初始密码。
修改初始密码:
mysql> ALTER USER USER() IDENTIFIED BY 'test123456';
Query OK, 0 rows affected (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> grant all privileges on *.* to root@"%" identified by "test123456" with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
至此安装完毕!
mysql5.7.20:安装教程的更多相关文章
- mysql8.0.20安装教程,mysql下载安装教程8.0.20
mysql8.0.20下载安装教程 mysql8.0.20安装教程 mysql安装包+mysql学习视频+mysql面试指南视频教程 下载地址: 链接:https://pan.baidu.com/s ...
- MySQL 8.0.20 安装教程图文详解(windows 64位)
MySQL 8.0.20 安装教程图文详解(windows 64位) 更新时间:2020年05月09日 15:09:04 转载 作者:瘦肉粥不加糖 这篇文章主要介绍了MySQL 8.0. ...
- Mysql5.7.20安装文档
Mysql5.7.20安装文档 一.Linxu下数据库的恢复和备份 当我们MySQL数据库保存重要数据的时候,备份工作极为重要.本文介绍如何使用mysqldump备份和恢复数据,使用该方法,可以将数据 ...
- MySQL8.0.20安装教程,MySQL8.0.20安装详细图文教程
1.下载链接如下: MySQL8.0.20版本 https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-20.html 其他版本:MySQL8 ...
- MySQL8.0.20安装教程图文详解,MySQL8.0.20安装教程winodws10
MySQL8.0.20安装教程图文详解,非常详细 一:mysql官网下载 https://dev.mysql.com/downloads/file/?id=494993 不用注册,直接下载就好 二:解 ...
- Apache2.4.23+PHP5.6.30+MySQL5.7.18安装教程
最近在工作中常常接触到PHP,自己也写过一些简单的PHP页面.我们知道PHP是在服务器端运行的脚本语言,因此我们需要配置服务器环境.之前为了省事直接使用的是wamp集成环境,但是突然某一天领导要求我们 ...
- Mysql5.7 Linux安装教程
1系统约定安装文件下载目录:/data/softwareMysql目录安装位置:/usr/local/mysql数据库保存位置:/data/mysql日志保存位置:/data/log/mysql 2下 ...
- linux下 mysql5.7.20安装(精华)
在linux 系统中mysql配置文件的读取顺序为: /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 第一步 创 ...
- mysql5.5下载安装教程
下载地址:https://dev.mysql.com/downloads/mysql/ 这里选择的是5.5的版本: 步骤1: 步骤2: 步骤三: 步骤四: 步骤5: 步骤6: 步骤7: 步骤8: 步骤 ...
- Windows 64 位 mysql 5.7.20 安装教程
mysql 5.7以上版本包解压中没有data目录和my-default.ini和my.ini文件以及服务无法启动的解决办法以及修改初始密码的方法 mysql官网下载地址:https://dev.my ...
随机推荐
- TAC队--团队选题报告
The Art of Code--团队选题报告 一个APP项目能否被大众所接受,能否拥有受众,the most important是它的idea. 一个好的idea可以为项目带来巨大的改变 一个 独特 ...
- Servlet 生命周期、工作原理-是单实例多线程
Servelet是单实例多线程的 参考:servlet单实例多线程模式 一.Servlet生命周期 大致分为4部:Servlet类加载-->实例化-->服务-->销毁 1.Web C ...
- pgm10
这部分讨论 MAP 估计.从某个角度上来说,我们可以将这个问题转换成为前面讨论过的: 这样一来我们只需要将原先的 sum-product 换成 max-sum 即可.话虽这么说,我们还是看看 Koll ...
- Gym - 101522H Hit!
H. Hit! time limit per test 1.0 s memory limit per test 256 MB input standard input output standard ...
- MT【170】裂项相消
已知$a,b>0$证明:$\dfrac{1}{a+2b}+\dfrac{1}{a+4b}+\dfrac{1}{a+6b}<\dfrac{3}{\sqrt{(a+b)(a+7b)}}$ 证明 ...
- 【刷题】LOJ 6010 「网络流 24 题」数字梯形
题目描述 给定一个由 \(n\) 行数字组成的数字梯形如下图所示.梯形的第一行有 \(m\) 个数字.从梯形的顶部的 \(m\) 个数字开始,在每个数字处可以沿左下或右下方向移动,形成一条从梯形的顶至 ...
- C++时间标准库时间time
转自:http://www.cnblogs.com/yukaizhao/archive/2011/04/29/cpp_time_system_time.html (玉开) C++标准库中的时间需要引用 ...
- mycat 入门教程
mycat 入门教程 之前已经对mycat的配置进行了详细记得介绍,下面就是一个mycat分库的小例子 schema.xml配置 <?xml version="1.0"?&g ...
- python的WSGI接口
WSGI:Web Server Gateway Interface. WSGI是为python语言定义的web服务器和web应用程序或框架之间的一种简单而实用的接口.wsgi是一个web组件的接口规范 ...
- 三次握手---TCP/IP
首先由Client发出请求连接即 SYN=1 ACK=0 (请看头字段的介绍), TCP规定SYN=1时不能携带数据,但要消耗一个序号,因此声明自己的序号是 seq=x 然后 Server 进行回复 ...