CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
来源:互联网 发布:常用统计分析软件 编辑:程序博客网 时间:2024/06/07 23:29
1、安装MariaDB
安装命令
yum -y install mariadb mariadb-server
安装完成MariaDB,首先启动MariaDB
systemctl start mariadb
设置开机启动
systemctl enable mariadb
接下来进行MariaDB的相关简单配置
mysql_secure_installation
首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
设置密码
其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
【删除匿名用户这步很重要,可能会出现,处理不慎会出现报错:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql',若出现该报错,请移步:解决匿名用户问题】
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的字符集
文件/etc/my.cnf
vi /etc/my.cnf
在[mysqld]标签下添加
init_connect='SET collation_connection = utf8_unicode_ci'init_connect='SET NAMES utf8'character-set-server=utf8collation-server=utf8_unicode_ciskip-character-set-client-handshake
文件/etc/my.cnf.d/client.cnf
vi /etc/my.cnf.d/client.cnf
在[client]中添加
default-character-set=utf8
文件/etc/my.cnf.d/mysql-clients.cnf
vi /etc/my.cnf.d/mysql-clients.cnf
在[mysql]中添加
default-character-set=utf8
全部配置完成,重启mariadb
systemctl restart mariadb.service
之后进入MariaDB查看字符集
mysql> show variables like "%character%";show variables like "%collation%";
显示为
字符集配置完成。
3、添加用户,设置权限
创建用户命令
mysql>create user username@localhost identified by 'password';
直接创建用户并授权的命令
mysql>grant all on *.* to username@localhost indentified by 'password';
授予外网登陆权限
mysql>grant all privileges on *.* to username@'%' identified by 'password';
授予权限并且可以授权
mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;
简单的用户和权限配置基本就这样了。
若要只授予部分权限,只需把all privileges或者all改为select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file其中一部分。
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- Centos 使用YUM安装MariaDB
- Centos 使用YUM安装MariaDB
- Centos 使用YUM安装MariaDB
- Centos 使用YUM安装MariaDB
- Centos 使用YUM安装MariaDB
- Centos 使用YUM安装MariaDB
- centos yum 安装 mariadb
- CentOS用yum安装、配置MariaDB
- CentOS用yum安装、配置MariaDB
- 字符编码简明教程
- HTML 5的革新——语义化标签(一)
- TestNG开源插件Arrow介绍
- ReentrantLock使用场景以及注意事项
- 欢迎使用CSDN-markdown编辑器
- CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
- swift计算型属性与懒加载的对比
- vector相关函数简介
- hdu 1864
- 进程关系
- VideoView-全屏播放
- 《leetCode》:Sliding Window Maximum
- Spring中基于Java的配置@Configuration和@Bean用法
- PRML读书笔记(四):信息论基础