centos8.2部署Servlet项目

腾讯云的CentOS 8.2

1.先在控制台创建密码以SSH连接

2.连接Xshell 用户名默认root

3.安装JDK

yum -y install java-1.8.0-openjdk

4.安装Tomcat

cd /root/soft/tomcat/bin
chmod +x *.sh
./startup.sh
  • 关闭tomcat
./shutdown.sh

5.安装MySQL

5.1 安装MySQL

yum install mysql-server

5.2 启动MySQL

sudo systemctl start mysqld
systemctl status mysqld 
ps -ef | grep mysqld

5.3 安全配置

在整个设置密码的过程中,总共有五步:设置 root 密码;是否禁止 root 账号远程登录;是否禁止匿名账号(anonymous)登录;是否删除测试库;是否确认修改。按照你自己的需求后,设置完成后即可。

ps:validate_password_policy的值有关。默认是1,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。
mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1       
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

5.4 MySQL允许远程连接

开启3306端口

mysql -h localhost -u root -p ##登录数据库,输入密码后完成登录
mysql> use mysql; ##选择 mysql 库
mysql> select user,host from user; ##查询连接配置
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

mysql> update user set host='%' where user='root';##允许使用 root 账户进行远程登录
mysql> flush privileges; ##刷新设置

5.5 通过navicat连接

6.部署项目

posted @   lwx_R  阅读(66)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示