CentOS7安装配置MariaDB

  ******************yum安装mariadb****************
  1. [root@aaa bbb]# yum install -y mariadb-server
 *********************启动服务*************************
  1. [root@aaa bbb]# systemctl start mariadb.service
`***************设置开机自启动服务*******************`
  1. [root@aaa bbb]# systemctl enable mariadb.service

    ***************对数据库进行基本设置*******************

    4、[root@aaa bbb]# mysql_secure_installation
    Set root password? [Y/n] Y ------>是否要设置root密码,选“Y” 或者直接回车
    … Success!
    Remove anonymous users? [Y/n] Y ------>是否移除匿名用户,选“Y” ,回车
    … Success!
    Disallow root login remotely? [Y/n] n ------>是否禁止root用户远程登录,选“n” ,回车,若选了Y,则表明仅本地登录
    … skipping.
    Remove test database and access to it? [Y/n] Y ------>是否移除test库,选“Y” ,回车
    - Dropping test database…
    … Success!
    - Removing privileges on test database…
    … Success!
    Reload privilege tables now? [Y/n] Y ------>是否重新加载权限列表,选“Y” ,回车
    … Success!

********************设置字符集************************************

5、[root@aaa bbb] # vim /etc/my.cnf
在[mysqld]标签下添加如下内容:
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
****************************************
6、 [root@aaa bbb] # vim /etc/my.cnf.d/mysql-clients.cnf
在[client]标签下添加如下内容:
default-character-set=utf8
*****************************************
7、[root@aaa bbb] # vim /etc/my.cnf.d/mysql-clients.cnf
在[mysql]标签下添加如下内容:
default-character-set=utf8

************************************重启服务****************************

8、[root@aaa bbb] # systemctl restart mariadb

*************************************登录数据库*************************

9、[root@aaa bbb]# mysql -uroot -proot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>

猜你喜欢

转载自blog.csdn.net/weixin_39772200/article/details/89427868