Detailed Ali cloud deployment ECS server CentOS7 install jdk, tomcat, mysql-- configure mysql (3)

Ready to work

Configuring JDK, Tomcat

Open Xsell, enter yum -y update, make sure that the server system is up to date, we need to wait for a while

If the description has been updated following the completion of

Then restart the server, input reboot

 Then enter php -v to check whether mysql has been installed, if you have installed delete the previous version, so installation is not successful, if not display the following instructions to install Service

 

Begin configuring MySql 5.7

First enter https://dev.mysql.com/downloads/repo/yum/

Note 57 

If it is not 57, it is 80, then follow to enter the same information below 

Enter wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

 Wait a minute, there will be as follows:

Then enter yum localinstall mysql57-community-release-el7-11.noarch.rpm

Input yum install mysql-community-server installation

 wait a moment

 wait a moment

Appear as the installation is successful

 Start MySQL, enter systemctl start mysqld.service

View MySQL running, enter systemctl status mysql.service, it indicates success appears as follows

 

Set boot

And are input systemctl enable mysqld systemctl daemon-reload

Whether the checks have been installed at startup, input systemctl list-unit-files | grep mysqld, if the following is displayed automatically start the installation has been completed Description

 View the default MySQL password

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

用默认密码登录MySQL,输入mysql -u root -p ,(注意输入密码时,密码不可见)

修改密码:输入mysql>set password for 'root'@'localhost'=password('你的密码');

 注意密码要求大写+小写+数字+特殊字符,如果你的密码简单,必须修改两个全局参数:

mysql> set global validate_password_policy=0;

mysql> set global validate_password_length=1;

开启远程登录,授权root远程登录 

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码'  WITH GRANT OPTION;

刷新使命令生效mysql>flush privileges;

配置默认编码为utf-8

先退出mysql模式,输入exit

 修改/etc/my.cnf配置文件,输入vi  /etc/my.cnf

然后按i,进行编辑

在[mysqld]下添加

character_set_server=utf8

init_connect='SET NAMES utf8'

按esc键 ,然后按 shift键 + ;键

输入wq保存退出

重启数据库,输入systemctl restart mysqld

然后 输入mysql -u root -p 再次进入数据库

查看编码,输入show variables like '%character%';

 

授权其它机器登录

首先打开阿里云的管理控制台,找到安全组规则,入网方向,添加安全组规则,开放3306端口,授权对象填写0.0.0.0/0授权所有ipv4地址。

进入Xsell

(1)查看3306端口是否打开:输入firewall-cmd --query-port=3306/tcp 

若此提示 FirewallD is not running,表示为不可知的防火墙,需要查看状态并开启防火墙

(2)查看防火墙状态:输入systemctl status firewalld

running 状态即防火墙已经开启,dead 状态即防火墙未开启

(3)开启防火墙:输入systemctl start firewalld

(4) 开通端口号3306:输入firewall-cmd --add-port=3306/tcp --permanent

 

提示成功即可

 (5)重新载入配置:输入firewall-cmd --reload

提示成功即可

(6)再次查看想开的端口是否已开:输入firewall-cmd --query-port=3306/tcp  提示yes表示成功 

Guess you like

Origin blog.csdn.net/qq_41937388/article/details/91447409
Recommended