博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux安装mysql
阅读量:7136 次
发布时间:2019-06-28

本文共 1562 字,大约阅读时间需要 5 分钟。

使用root用户按照如下步骤执行

yum install -y wget

选择一个目录,并进行下载

wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

yum install mysql-community-server -y

默认安装目录 /usr/share/mysql-8.0

启动mysql

systemctl start mysqld

验证是否启动

systemctl status mysqld

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

grep 'temporary password' /var/log/mysqld.log

2018-06-12T05:22:53.292648Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 4eKKk&u<ds1e

可以看到初始密码为 4eKKk&u<ds1e

登录数据库:

mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.22Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

重新设置root密码

alter user 'root'@'localhost' identified by 'AbC!@#123';

use mysql;

select host, user, authentication_string, plugin from user;

update user set host = '%' where user = 'root';

[选择使用,允许使用简单密码]

[

set global validate_password.policy=0;
set global validate_password.length=1;

]

修改加密规则

ALTER USER 'root'@'%' IDENTIFIED BY 'AbC!@#123' PASSWORD EXPIRE NEVER;

更新 root 用户密码(允许navicat登录)

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Mysql@2018';

刷新权限

FLUSH PRIVILEGES;

转载于:https://www.cnblogs.com/cnsdhzzl/p/9660997.html

你可能感兴趣的文章
C语言中const的用法
查看>>
理解inode
查看>>
我的友情链接
查看>>
Delegates (Delegate, Func, Predicate, Action and Lambda)
查看>>
快速打开Windows的大部分程序
查看>>
SSIS 系列 - Lookup 组件的使用与它的几种缓存模式 - Full Cache, Partial Cache, NO Cache...
查看>>
监测textfield输入的值得变化
查看>>
lvs简介和命令
查看>>
RPM 命令详解
查看>>
在Centos7中使用firewall添加端口
查看>>
python 通过threading多线程ssh
查看>>
spark-submit使用及说明
查看>>
jquery验证表单的js代码(HTML+CSS+PHP代码部分省略)
查看>>
Linux学习之CentOS(二十)--CentOS6.4下修改MySQL编码方法
查看>>
我的友情链接
查看>>
手动删除oracle数据库
查看>>
(转)chrome浏览器在各常用移动终端上的User-Agent
查看>>
向Maven本地仓库添加本地jar包
查看>>
Nginx 配置虚拟主机
查看>>
CHI Hair Straightener
查看>>