云核算架构师-带你设备MySQL数据库并去除安全隐患

Mariabd安全配备导游

1.设备完mariadb-server后,作业mysql_secure_installation去除安全隐患
mysql_sechttp协议ure_installation会实行几个设置:

  • 为root用户设置暗码
  • 删去匿名账号
  • 吊销root用户远程登录
  • 删去test库和对test库的拜访权限
  • 改写授权表使修改收效
[root@xuegod63 ~]# mysql_securhttp协议e_inst宫颈癌allation #进入安全配备导游

通过这几项的设置能够进步MySQL库的安全。主张出产环境中MySQL数据库软件设备完结后一定要运
行一次mysql_sehttpclientcure_installa工商银行客服电话tion,详细步骤请参看下面的指令:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDE教程图片Dhttp 404 FOR ALL MySQL
SERVERS IN PRO工商银行客服电话DUCTION USE! PLEASphpstudyE READ EACH STEP CAREFULLY!
In order枸杞 to log into MySQL to secure it, we'll need the current
password for the root user. If you've just i宫崎骏nstalled MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): #初度作业直接教程刷点券回车,因为root用户没有暗码
OK, successfully used passwordphp是什么语言, moving on…
Setting the root pa数据库体系的特色ssword ensures that nobody canphp是什么 log into the MySQL
root user without the proper authorisation.
Set root password教程网站? [Y/n] Y #是否设置root用户暗码,输入Y
New password: 12345php76 #新暗码123456
Re-ephpmyadminnter new password: 123456
Password updated successfully!
。。。
Remove anonymous users? [Y数据库是什么/n] Y数据库软件 #是否删去匿名用户,出产环境主张删去,HTTP所以直接回车或 Y
... Success!
Normally, root should only be allowed to connechttp 404t from 'localhost'. This
ensures that someonehttpwatch cannot guess at the root password from the network数据库体系工程师.
Disallow root login remotely? [Y/n] Y #是否阻止roo数据库体系工程师t远程登录,依据自己的需求挑选
Y/n并回车,主张阻止
... Success!
By default, MariaDB comes with a database named 'test' that anyon教程地图e can
access. This is also intended only狗狗币 for testing, and should be removed
before moving into a prod数据库体系的特色uction environment.
Remove test database and access to it? [Y/n] Y #是否删去test数据库,直接回车或Y - Dropping tephp是前端仍是后端st database...
... Succeshttpwatchs!
- Removing pr教程的意思ivileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes mhttps和http的差异ade so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y #是否从头加载权限表,直接回车
... Success!
Cl数据库规划eaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should no教程的意思w be secure.
Thanks for usi宫崎骏ng MariaDB!

假定不做安全装http代理备,设置root暗码

[root@xuegod63 ~]# mysqladmin -u root password "123456"

2. 数据库联接

联接MariaDB数据库,联接本机能够去掉 -h选项

# mysql #如MariaDB没有设置暗码,并在本地上登录,而且是教程之家运用默许端口的情况
下,可httpclient以直接运用mysql指令登录。
或:
# mphp是前端仍是后端ysql -h IP -u USER -pPASS #如 MariaDB不是设备在本地时,需求运用-h选项指定
IP登录,如 MariaDB教程诀窍2用户设置了暗码数据库体系的特色时,需求运用-u选项指定用户,并运用-p选项指定暗码,留心的是
在-p选项和暗码之间不能有空格,否则在指令实行后需求再次php中文网输入暗码,并将有空格的暗码串识别为登录
的数据库。
Mari教程之家aDB的超级办理员是root用户,具有MariaDB数据库的最高权限。

3. 检验数据是否正常

[root@xuegod教程图片63 ~]# mysql -u root -p123456 
MariaDB [(none)]> show databases; #没有test数据库 #实行时,所有指令以;号完毕
+-------------------------+
| Database |
+----------教程诀窍2---------------+
| informat数据库办理体系ion_schhttpwatchema |
| mysql |
| ucenter |
+-------------------------+
3 rows in set (0.00 sec枸杞)
M教程刷点券ariaDB [(none)]> exit #退出http://192.168.1.1登录指令能够加分号,也能够不PHP加分号。

4. 检验网站是否支撑PHP

[root@xuegod63 ~]# cd /var/Gowww/html/
[root@xuegod63 html]# vim index.php文件用什么软件翻开php 
&l数据库是什么t;?pphpstudyhp
phpinfo();
?>
[root@xuegod63 html]# systemctl restart httpd #重启httpd服宫崎骏务。
[root@xuegod63 html]# iptables -F #清空防火墙

检验:

http://192.168.1.63/index.httpwatchphp
云核算架构师-带你设备MySQL数据库并去除安全隐患

LAMP网站架构树立完结

到此MySQLPHP数据库设备http协议成功

小伙伴想要获取学习视频+笔php是什么意思记材料的

请添加咱们小姐姐

咱们也有Windows上设备mysql教程哦!

云核算架构师-带你设备MySQL数据库并去除安全隐患