zoukankan      html  css  js  c++  java
  • MariaDB配置

    安装

    1 yum -y install mariadb mariadb-server

    这是centos的命令,ubuntu不用安装。

    启动

    1 systemctl start mariadb     #启动MariaDB
    2 
    3 systemctl enable mariadb      #设置开机启动
    4 
    5 #ubuntu
    6 update-rc.d mysql defaults
    7 systemctl start mysql

    设置密码

    1 mysql_secure_installation

    修改字符集

    centos

     1 vi /etc/my.cnf
     2 
     3 #在[mysqld]标签下添加
     4 init_connect='SET collation_connection = utf8_unicode_ci' 
     5 init_connect='SET NAMES utf8' 
     6 character-set-server=utf8 
     7 collation-server=utf8_unicode_ci 
     8 skip-character-set-client-handshake
     9 
    10 vi /etc/my.cnf.d/client.cnf
    11 
    12 #在[client]中添加
    13 default-character-set=utf8
    14 
    15 vi /etc/my.cnf.d/mysql-clients.cnf
    16 
    17 #在[mysql]中添加
    18 default-character-set=utf8
    19 
    20 systemctl restart mariadb     #重启mariadb

    ubuntu

    1 vim /etc/mysql/mariadb.conf.d/50-server.cnf 
    2  
    3 #bind-address = 127.0.0.1     注释掉这行
    4 
    5 #在[mysqld]标签下添加
    6 skip-character-set-client-handshake    
    ubuntu自带的mariadb的字符集为utf8bm4,添加skip-character-set-client-handshake设置会忽略client的字符集,始终与server保持一致。
    1 mysql -uroot -p123456
    2 #查看字符集
    3 show variables like "%character%";
    4 show variables like "%collation%";

    创建用户,授权

    1 mysql>create user ‘mysql’@localhost identified by '123456';
    2 
    3 mysql>grant all on *.* to ‘mysql’@localhost identified by '123456';
    4 
    5 mysql>grant all privileges on *.* to ‘mysql’@'%' identified by '123456';
  • 相关阅读:
    Docker01 centos系统安装、centos安装docker、docker安装mongoDB
    WebFlux03 SpringBoot WebFlux实现CRUD
    WebFlux02 SpringBoot WebFlux项目骨架搭建
    WebFlux01 webflux概念、异步servlet、WebFlux意义
    ReactiveStream03
    ReactiveStream02
    ReactiveStream01
    Stream03
    python爬虫2
    python爬虫1
  • 原文地址:https://www.cnblogs.com/wj5633/p/6583158.html
Copyright © 2011-2022 走看看