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

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

hot3.png

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.repomysql-community-source.repo[root@localhost yum.repos.d]# yum repolist all | grep mysql  #查看mysql的源mysql-connectors-community/x86_64 MySQL Connectors Community         启用:    21mysql-connectors-community-source MySQL Connectors Community - Sourc 禁用mysql-tools-community/x86_64      MySQL Tools Community              启用:    36mysql-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         启用:   128mysql57-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 namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql>  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,下载地址

输入图片说明

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

转载于:https://my.oschina.net/weidedong/blog/754516

你可能感兴趣的文章
Docker发布应用程序指南
查看>>
Rider EAP17带来了许多改进但缺乏.NET Core调试功能
查看>>
别动我的代码!聊聊那些代码保护的艺术
查看>>
迅雷“星域”打通最后一公里重新定义CDN
查看>>
何时该用无服务器,何时该用Kubernetes?
查看>>
在Vue工作流中使用CSS Modules
查看>>
如何搭建一个私人网盘
查看>>
PowerDesigner 与 SQL Server 的协作(壹)建立连接
查看>>
PHP错误、异常汇总
查看>>
浅谈PHP的类型约束
查看>>
BootstrapDialog使用
查看>>
fetch polyfill 发布0.02版
查看>>
jetbrains从入门到卸载(一) 安装指南
查看>>
React模式【译】
查看>>
React Native填坑之旅--HTTP请求篇
查看>>
Block的一些定义和使用
查看>>
从一滴水说起,谈谈CSS形状的生成思路
查看>>
jenkins 构建后上传至svn
查看>>
Java 8 并发教程:同步和锁
查看>>
<译> MIT 为何停掉 SICP?
查看>>