centos 7.3 服务器环境搭建——MySQL 安装和配置
服务器信息如下:
服务器:阿里云
系统 centos 7.3 (阿里云该版本最新系统)
mysql版本:5.7.18 (当前时间最新版本)
连接服务器工具:xshell
1、 配置yum源
更新yum源
yum update
下载mysql源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
安装MySQL
yum install mysql-community-server
注意:在这过程中会询问的都按y然后回车允许

2、安装MySQL
yum install mysql-community-server
3、启动MySQL
启动MySQL服务
systemctl start mysqld
查看MySQL的启动状态
systemctl status mysqld
设置MySQL开机启动
systemctl enable mysqld
systemctl daemon-reload
4、修改root默认密码
找到root默认密码
grep 'temporary password' /var/log/mysqld.log
进入mysql控制台, 输入上述查询到的默认密码
mysql -uroot -p
第一次登录必须修改初始密码:(最新mysql要求密码必须包含大小写字母和字符,长度大于等于8个字符)
alter user root@localhost identified by '连接密码!';
显示数据库内容
show databases;
查看端口号
show global variables like 'port';
5、添加远程登录用户
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须修改root允许远程连接,或者添加一个允许远程连接的帐户

添加远程帐户(密码同上规则)
GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' IDENTIFIED BY '连接密码!' WITH GRANT OPTION;
立即生效
flush privileges;
退出mysql操作
exit

总结:
my.cnf文件:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]

#skip_grant_tables跳过密码直接登录

#validate_password=off 跳过密码强度验证(大小写+特殊字符+数字)
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

#--------------------------

#将数据库切换至mysql库
mysql> USE mysql;
#修改密码
mysql> UPDATE user SET authentication_string=PASSWORD(‘数据库连接密码’)WHERE user=’root’;
#刷新MySQL权限相关的表
mysql> flush privileges;
mysql> exit;
添加远程账户访问:
grant all privileges on *.* to 'root'@'%%' identified by '数据库连接密码' with grant option;
立即生效:flush privileges;

update mysql.user set authentication_string=password('数据库连接密码') where user='root';

关闭密码验证:my.cnf文件中加入:validate_password=off
修改密码:
update user set authentication_string=password("数据库连接密码") where user='root';

centos 7.3 服务器环境搭建——MySQL 安装和配置的更多相关文章

  1. CentOS下Web服务器环境搭建LNMP一键安装包

    CentOS下Web服务器环境搭建LNMP一键安装包 时间:2014-09-04 00:50来源:osyunwei.com 作者:osyunwei.com 举报 点击:3797次 最新版本:lnmp- ...

  2. Linux环境下mysql安装并配置远程访问

    环境:centOS 1.下载mysql安装文件 [root@localhost ~]# wget http://dev.mysql.com/get/mysql-community-release-el ...

  3. Linux环境下服务器环境搭建-mysql

    下载对应版本的mysql.rpm(Linux 6 安装el6 Linux 7 安装el7) 安装环境 centos 7,安装版本mysql57-community-release-el7-9.noar ...

  4. centos LNMP第一部分环境搭建 LAMP LNMP安装先后顺序 php安装 安装nginx 编写nginx启动脚本 懒汉模式 mv /usr/php/{p.conf.default,p.conf} php运行方式SAPI介绍 第二十三节课

    centos  LNMP第一部分环境搭建 LAMP安装先后顺序  LNMP安装先后顺序 php安装 安装nginx  编写nginx启动脚本   懒汉模式  mv   /usr/local/php/{ ...

  5. centos LAMP第一部分-环境搭建 Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课

    centos LAMP第一部分-环境搭建  Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课 打命令之后可以输入: e ...

  6. LNAMP服务器环境搭建(手动编译安装)

    LNAMP服务器环境搭建(手动编译安装) 一.准备材料 阿里云主机一台,操作系统CentOS 6.5 64位 lnamp.zip包(包含搭建环境所需要的所有软件) http://123.56.144. ...

  7. 服务器环境搭建系列(四)-mysql篇

    1.按照上一篇服务器环境搭建系列(三)-JDK篇中的方法检查系统是否已经预装Mysql并卸载. 2.下载mysql,这里是MySQL-server-5.5.25-1.linux2.6.x86_64.r ...

  8. Windows环境搭建mysql服务器

    Windows环境搭建mysql服务器: 1.下载mysql-installer-community-5.7.3.0-m13.2063434697并安装  安装详细步骤>> 2.安装mys ...

  9. CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置

    介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...

随机推荐

  1. HZOJ 数颜色

    一眼看去树套树啊,我可能是数据结构学傻了…… 是应该去学一下莫队进阶的东西了. 上面那个东西我没有打,所以这里没有代码,而且应该也不难理解吧. 这么多平衡树就算了,不过线段树还是挺好打的. 正解3: ...

  2. 2018-8-10-WPF-如何在绑定失败异常

    title author date CreateTime categories WPF 如何在绑定失败异常 lindexi 2018-08-10 19:16:53 +0800 2018-05-17 1 ...

  3. px em rem %作为单位使用

    博客地址 :https://www.cnblogs.com/sandraryan/ px 我们都很熟悉啦,但是固定大小无法适配各种屏幕. rem是CSS3新增的一个相对单位(root em,根em), ...

  4. mosquitto/openssl 在RK3288上的编译以及MQTT客户端的代码示例

    1,依赖库openssl 的交叉编译 (1)配置编译器信息 setarch i386 ./config no-asm shared --cross-compile-prefix=arm-linux-a ...

  5. 通过PdfiumViewer.dll实现pdf直接从流显示(效果不好)

    开源的PdfiumViewer.dll并不完整 需要不开源的pdfium.dll配合使用 引用只需添加PdfiumViewer.dll,但pdfium.dll必须跟它放在一个路径下 界面中添加控件: ...

  6. libsvm的安装,数据格式,常见错误,grid.py参数选择,c-SVC过程,libsvm参数解释,svm训练数据,libsvm的使用详解,SVM核函数的选择

    直接conda install libsvm安装的不完整,缺几个.py文件. 第一种安装方法: 下载:http://www.csie.ntu.edu.tw/~cjlin/cgi-bin/libsvm. ...

  7. spring json 返回中文乱码

    如前台显示的json数据中的中文为???,则可尝试以下方法. 方法一(推荐):在@RequestMapping中添加  produces={"text/html;charset=UTF-8; ...

  8. MAMP "403 Forbidden You don't have permission to access / on this server."

    2015年01月22日 17:27:31 阅读数:3488 用MAMP搭建本地服务器的时候,设置好ip和端口等属性之后,浏览器访问,报 403错误: Forbidden You don't have ...

  9. CSS 实现单行及多行文字省略

    单行文字省略 很多时候不确定字数限制,但换行可能影响整体设计,这个时候常用就是文字省略加全文字提示了 .dom{ text-overflow: ellipsis; overflow: hidden; ...

  10. Spring Data -Specification用法和常用查询方法(in,join,equal等)

    Spring Data -Specification用法和常用查询方法(in,join,equal等) 前言 入门例子 Repository层常用写法 Specification 的用法 总结 前言 ...