CentOS 751804安装MariaDB 555687.docx
- 文档编号:13504216
- 上传时间:2023-06-14
- 格式:DOCX
- 页数:10
- 大小:292.27KB
CentOS 751804安装MariaDB 555687.docx
《CentOS 751804安装MariaDB 555687.docx》由会员分享,可在线阅读,更多相关《CentOS 751804安装MariaDB 555687.docx(10页珍藏版)》请在冰点文库上搜索。
CentOS751804安装MariaDB555687
CentOS7.5.1804安装MariaDB5.5.56
ByToperLv
2018.8.7
1安装环境
1.1CentOS版本
[root@centos~]#cat/etc/redhat-release
CentOSLinuxrelease7.5.1804(Core)
1.2MariaDB版本
MariaDB版本:
5.5.56
1.3主机名和IP
主机名:
centos
IP:
192.168.80.160
1.4SELinux
禁用SELinux
[root@centos~]#setenforce0设置SELinux为被动模式
[root@centos~]#getenforce查看SELinux当前模式
Permissive
[root@centos~]#vi/etc/selinux/config修改SELinux模式,重启后生效
修改前SELinux=enforcing
修改后SELinux=disabled
1.5防火墙
[root@centos~]#systemctlstopfirewalld关闭防火墙
[root@centos~]#systemctldisablefirewalld禁用防火墙自启动
Removedsymlink/etc/systemd/system/multi-user.target.wants/firewalld.service.
Removedsymlink/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
2MySQL安装
2.1配置YUM源
[root@centos~]#mount/dev/cdrom/media连接CentOS7.5光驱,将光盘挂载至/media目录
mount:
/dev/sr0iswrite-protected,mountingread-only
[root@centos~]#vi/etc/yum.repos.d/centos7-iso.repo配置光驱为YUM源
2.2安装MariaDB
[root@centos~]#yuminstall-ymariadb\*安装mariadb
[root@centos~]#systemctlstartmariadb安装完成后,启动mariadb服务
[root@centos~]#systemctlenablemariadb设置mariadb服务开机自启动
[root@centos~]#mysql-uroot-p
Enterpassword:
MariaDB5.5.56版本默认密码为空
2.3MariaDB安全配置
[root@centos~]#mysql_secure_installation
首先是设置密码,会提示先输入密码
Entercurrentpasswordforroot(enterfornone):
<–初次运行直接回车
Setrootpassword?
[Y/n]<–是否设置root用户密码,输入y,输入两次密码,这里密码设置为Root:
123
其他配置
Removeanonymoususers?
[Y/n]<–是否删除匿名用户,y回车
Disallowrootloginremotely?
[Y/n]<–是否禁止root远程登录,y回车,
Removetestdatabaseandaccesstoit?
[Y/n]<–是否删除test数据库,y回车
Reloadprivilegetablesnow?
[Y/n]<–是否重新加载权限表,y回车
初始化MySQL完成,接下来测试登录
[root@centos~]#mysql-uroot-p使用修改后密码可以成功登陆
2.4MariaDB字符集配置
[root@centos~]#vi/etc/f在[mysqld]标签下添加如下内容并保存
init_connect='SETcollation_connection=utf8_unicode_ci'
init_connect='SETNAMESutf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
[root@centos~]#vi/etc/f.d/f
在[client]中添加
default-character-set=utf8
[root@centos~]#vi/etc/f.d/mysql-f
在[mysql]中添加
default-character-set=utf8
[root@centos~]#systemctlrestartmariadb重启mysqld服务
[root@centos~]#mysql-uroot-p登录数据库,查看字符集设置如下
Enterpassword:
MariaDB[(none)]>showvariableslike"%character%";showvariableslike"%collation%";
2.5创建远程登录用户
[root@centos~]#mysql-uroot-p
Enterpassword:
MariaDB[(none)]>selectUser,hostfrommysql.user;查看mysql用户信息
MariaDB[(none)]>grantallprivilegeson*.*toroot@'%'identifiedby'Root:
123'withgrantoption;设置用户root可以远程登录,密码为Root:
123
MariaDB[(none)]>selectUser,hostfrommysql.user;查看mysql用户信息,root已经有远程登录权限
使用NavicatforMySQL从外部登录MariaDB测试
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- CentOS 751804安装MariaDB 555687 751804 安装 MariaDB