标签:htm star lte 输入密码 war disable sysconfig service ble
在虚拟机上安装CentOS7不详细说:设置联外网访问的话,建议选桥接模式通信,这里用的镜像为CentOS-7-x86_64-DVD-1804.iso,安装过程需要打开en33,安装好再配置自动获取也行,安装时需要配置时间,选择要安装的软件(不能用默认的安装,那是最小化安装,我选择的是桌面系统的所有复选框)。
安装MySQL5.7的参考来源:
https://www.cnblogs.com/xinjing-jingxin/p/8025805.html
https://blog.csdn.net/weixin_38187469/article/details/79257694
https://blog.csdn.net/weixin_41688619/article/details/80360351
安装步骤:
1、wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2、sudo rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
3、sudo yum install mysql-community-server
4、启动MySQL
systemctl status mysqld.service --查看mysql状态
systemctl start mysqld.service --只有启动MySQL后才能登陆
开机启动:
systemctl enable mysqld
systemctl daemon-reload
5、初次登录
安装完成后在/var/log/mysqld.log文件中生成了一个随机的默认密码;使用以下命令查看默认的登录密码
more /var/log/mysqld.log,找到如下所示的位置:
2018-12-01T19:25:41.505751Z 1 [Note] A temporary password is generated for root@
localhost: Rth0tJjimf!T,即为默认密码,记录下密码。输入mysql -uroot -p并输入密码后登陆mysql。
6、修改登录MySQL的密码(不修改执行sql语句会报错)
alter user ‘root‘@‘localhost‘ identified by ‘root‘; 此时报错,因为默认密码要求包括字母、数字和特殊字符,执行show variables like ‘%password%‘;查看密码设置的规定。
这里修改密码为:alter user ‘root‘@‘localhost‘ identified by ‘ZhZH_123456‘; 以后用下面的方法登陆mysql(设置开机启动不需要登录):mysql -uroot -p
7、授权远程访问
1、授权:use mysql --> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘ZhZH_123456‘ with grant option;
2、关闭防火墙:sudo systemctl stop firewalld.service
3、关闭开机启动:sudo systemctl disable firewalld.service
4、安装iptables防火墙,执行以下命令安装iptables防火墙:sudo yum install iptables-services
5、配置iptables防火墙,打开指定端口:修改防火墙配置文件sudo vi /etc/sysconfig/iptables,
加入端口配置-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
6、设置iptables防火墙开机启动:sudo systemctl enable iptables
7、本机用navicat for mysql等工具连接,测试连接成功!
标签:htm star lte 输入密码 war disable sysconfig service ble
原文地址:https://www.cnblogs.com/zhzhair-coding/p/10052175.html