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 ...
随机推荐
- Docker 将一堆镜像 导成一个文件
docker save istio/galley istio/citadel istio/mixer istio/sidecar_injector istio/proxy_init istio/pro ...
- Python中xlrd和xlwt模块读写Excel的方法
本文主要介绍可操作excel文件的xlrd.xlwt模块.其中xlrd模块实现对excel文件内容读取,xlwt模块实现对excel文件的写入. 着重掌握读取操作,因为实际工作中读取excel用得比较 ...
- WebAPI框架里设置异常返回格式统一
直接上代码 /// <summary> /// 消息代理处理,用来捕获这些特殊的异常信息 /// </summary> public class CustomErrorMess ...
- spring注入 属性注入 构造器注入 set方法注入
spring注入 属性注入 构造器注入 set方法注入(外部bean注入)
- 一本通1628X-factor Chain
1628:X-factor Chain 时间限制: 1000 ms 内存限制: 524288 KB [题目描述] 原题来自 POJ 3421 输入正整数 x,求 x 的大于 1 的因子 ...
- Luogu1641 SCOI2010生成字符串(组合数学)
NOI2018冒泡排序的一个子问题. #include<iostream> #include<cstdio> #include<cmath> #include< ...
- SpringBoot设置事务隔离等级
"If you're gonna play the game, boy, ya gotta learn to play it right" Spring Boot 使用事务非常简单 ...
- 【题解】 Luogu P1402 酒店之王 (二分图匹配)
懒得复制,原题目戳我 Solution: 这题没想到这么水,就是两个二分图而已 如果房间的二分图没匹配成功就直接进入下一个人 如果房间的二分图匹配成功,食物二分图匹配不成功就把房间的\(be[ ]\) ...
- easyui的tab加载页面中的form重复提交
http://blog.csdn.net/fxz1982/article/details/8987769 Easyui中的tabs组件以href方式加载目标页面,如果目标页面中有dialog或者win ...
- CSS框架960Grid从入门到精通一步登天
http://blog.chinaunix.net/uid-22414998-id-2878529.html 1.什么是CSS框架? CSS框架是一种你能够使用在你的web项目中概念上的结构, ...