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 ...
随机推荐
- Alpha 冲刺四
团队成员 051601135 岳冠宇 051604103 陈思孝 031602629 刘意晗 031602248 郑智文 031602234 王淇 会议照片 项目燃尽图 项目进展 实现后端聊天接收,搜 ...
- MyBatis传入多个参数的问题(转)
一.单个参数: public List<XXBean> getXXBeanList(String xxCode); <select id="getXXXBeanList&q ...
- TRichEdit怎样新增的内容到最后一行?
Delphi里使用TRichEdit,使用SetSelTextBuf时可以设置显示的字体格式,但是显示位置是在当前的插入光标后,如果人为改变插入光标的位置,比如在其他位置单,以后再插入的内容位置就没办 ...
- 【刷题】BZOJ 4254 Aerial Tramway
Description You own a park located on a mountain, which can be described as a sequence of n points ( ...
- 【BZOJ3733】[Pa2013]Iloczyn (搜索)
[BZOJ3733][Pa2013]Iloczyn (搜索) 题面 BZOJ 题解 把约数筛出来之后,直接爆搜,再随便剪枝就过了. 最近一句话题解倾向比较严重 #include<iostream ...
- 数位DP学习笔记
数位DP学习笔记 什么是数位DP? 数位DP比较经典的题目是在数字Li和Ri之间求有多少个满足X性质的数,显然对于所有的题目都可以这样得到一些暴力的分数 我们称之为朴素算法: for(int i=l_ ...
- USACO Section 1.4 Mother's Milk 解题报告
题目 题目描述 有三个牛奶桶,三个桶的容积分别是A,B,C,最小为1,最大为20.刚开始只有第三个桶里面装满了牛奶,其余两个桶都是空的.我们现在可以将第三个桶中的牛奶往其他两个桶里面倒一些牛奶,然后还 ...
- Python GIL全局解释器锁
'''在python原始解释器Cpython中存在GIL(Global Interpreter Lock,全局解释器锁),因此在执行Python代码 时,会产生互斥锁来限制线程对共享资源的访问,指导接 ...
- 使用alien命令让deb包和rpm包互相转换
OS version: CentOS7 / Debian9 发现alien这个命令时很惊喜,之前在debian上安装etcd找不到安装包感觉很不科学,有了alien命令事情一下就变简单了. 这里以et ...
- 本地如何连接虚拟机上的MySql
今天在本地链接虚拟机上的MySql,然而链接失败了!甚是尴尬! 首先想一想是什么原因导致链接失败: 基础环境:在Linux上安装mysql 1.检查虚拟机IP在本地是否可以ping 通过 虚拟机IP: ...