欢迎投稿

今日深度:

centos7.2安装maridb和开启3306端口,centos7.2maridb

centos7.2安装maridb和开启3306端口,centos7.2maridb


1、安装MariaDB

安装命令

yum -yinstall mariadb mariadb-server

安装完成MariaDB,首先启动MariaDB

systemctl start mariadb

设置开机启动

systemctl enable mariadb

接下来进行MariaDB的相关简单配置

mysql_secure_installation

首先是设置密码,会提示先输入密码

Enter current password for root (enter for none):<–初次运行直接回车

设置密码

Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码

其他配置

Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车

Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,

Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车

Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车

初始化MariaDB完成,接下来测试登录

mysql -uroot -ppassword

完成。


2.Mariadb 开启远程连接

2.1 使用“mysql -uroot -proot”命令可以连接到本地的mysql服务

2.2 使用“use mysql”命令,选择要使用的数据库

2.3 使用“GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;”命令可以更改远程连接的设置。

2.4 使用“flush privileges;”命令刷新刚才修改的权限,使其生效。

2.5 使用“select host,user from user;”查看修改是否成功。



3.centos7中打开3306端口

3.1输入命令

[caibo@localhost /]$ firewall-cmd --zone=public --add-port=3306/tcp --permanent
success

3.2应用设置

[caibo@localhost /]$firewall-cmd --reload



附录:

	//开启firewalld防火墙
	systemctl stop firewalld.service
	//关闭firewalld防火墙
	systemctl stop firewalld.service
	
	//开启/关闭iptables防火墙
	systemctl start iptables.service
	systemctl stop  ip6tables.service



www.htsjk.Com true http://www.htsjk.com/mariadb/24984.html NewsArticle centos7.2安装maridb和开启3306端口,centos7.2maridb 1、安装MariaDB 安装命令 yum -y install mariadb mariadb-server 安装完成MariaDB,首先启动MariaDB systemctl start mariadb 设置开机启动 systemctl enable mariadb 接下...
相关文章
    暂无相关文章
评论暂时关闭