文档章节

centos7安装mysql

weidedong
 weidedong
发布于 2016/10/05 01:23
字数 471
阅读 47
收藏 3

1.配置源

# wget http://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm
# rpm -Uvh  mysql57-community-release-el7-9.noarch.rpm  #安装源,下载的那个rpm
警告:mysql57-community-release-el7-9.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql57-community-release-el7-9  ################################# [100%]
# ls /etc/yum.re* | grep mysql   #查看安装的源
mysql-community.repo
mysql-community-source.repo
[root@localhost yum.repos.d]# yum repolist all | grep mysql  #查看mysql的源
mysql-connectors-community/x86_64 MySQL Connectors Community         启用:    21
mysql-connectors-community-source MySQL Connectors Community - Sourc 禁用
mysql-tools-community/x86_64      MySQL Tools Community              启用:    36
mysql-tools-community-source      MySQL Tools Community - Source     禁用
mysql-tools-preview/x86_64        MySQL Tools Preview                禁用
mysql-tools-preview-source        MySQL Tools Preview - Source       禁用
mysql55-community/x86_64          MySQL 5.5 Community Server         禁用
mysql55-community-source          MySQL 5.5 Community Server - Sourc 禁用
mysql56-community/x86_64          MySQL 5.6 Community Server         禁用
mysql56-community-source          MySQL 5.6 Community Server - Sourc 禁用
mysql57-community/x86_64          MySQL 5.7 Community Server         启用:   128
mysql57-community-source          MySQL 5.7 Community Server - Sourc 禁用
mysql80-community/x86_64          MySQL 8.0 Community Server         禁用
mysql80-community-source          MySQL 8.0 Community Server - Sourc 禁用

2.安装

# yum install -y  mysql-community-server  #执行完就坐等好了,是不是很简单呢

3.启动mysql

# systemctl start mysqld
[root@localhost yum.repos.d]# systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2016-10-04 22:55:33 CST; 5s ago

4.修改密码

# grep 'temporary password' /var/log/mysqld.log   #查看初始密码
2016-10-04T14:55:29.376951Z 1 [Note] A temporary password is generated for root@localhost: hIkatKeYQ8*9
# mysql -uroot -p     #输入初始密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';   #修改密码
Query OK, 0 rows affected (0.02 sec)

5.开放远程连接权限

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>  select host,user from user;
+-----------+-----------+
| host      | user      |
+-----------+-----------+
| localhost | mysql.sys |
| localhost | root      |
+-----------+-----------+
2 rows in set (0.01 sec)
mysql>  Grant all privileges on *.* to 'root'@'%' identified by 'MyNewPass4!' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  select host,user from user;
+-----------+-----------+
| host      | user      |
+-----------+-----------+
| %         | root      |
| localhost | mysql.sys |
| localhost | root      |
+-----------+-----------+
3 rows in set (0.00 sec)

使用Sequel Pro测试连接mysql,下载地址http://www.sequelpro.com/download/

输入图片说明

注:如果想修改默认配置,如db文件目录,请修改文件/etc/my.cnf

© 著作权归作者所有

共有 人打赏支持
上一篇: centos7安装Grafana
下一篇: centos7安装mongodb
weidedong
粉丝 4
博文 86
码字总数 27565
作品 0
深圳
私信 提问

暂无文章

Confluence 6 自定义你的空间

通过对你的空间进行界面的自定义能够让你的空间更加出类拔萃。 如果你具有空间管理员权限,你可以修改你空间的颜色配色,添加你自己的空间标识,选择是否在你空间中显示边栏。或者你可以进入...

honeymose
56分钟前
1
0
Ubuntu18.04 安装MySQL

1.安装MySQL sudo apt-get install mysql-server 2.配置MySQL sudo mysql_secure_installation 3.设置MySQL非root用户 设置原因:配置过程为系统root权限,在构建MySQL连接时出现错误:ERROR...

AI_SKI
今天
3
0
3.6 rc脚本(start方法) 3.7 rc脚本(stop和status方法) 3.8 rc脚本(以daemon方式启动)

3.6-3.7 rc脚本(start、stop和status方法) #!/usr/bin/env python# -*- coding: utf-8 -*-# [@Version](https://my.oschina.net/u/931210) : python 2.7# [@Time](https://my.oschina.......

隐匿的蚂蚁
今天
3
0
Cnn学习相关博客

CNN卷积神经网络原理讲解+图片识别应用(附源码) 笨方法学习CNN图像识别系列 深度学习图像识别项目(中):Keras和卷积神经网络(CNN) 卷积神经网络模型部署到移动设备 使用CNN神经网络进行...

-九天-
昨天
5
0
flutter 底部输入框 聊天输入框 Flexible

想在页面底部放个输入框,结果键盘一直遮住了,原来是布局问题 Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("评论"), ...

大灰狼wow
昨天
4
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部