zoukankan      html  css  js  c++  java
  • linux安装mysql的分支mariadb

    1.配置官方的mariadb的yum源,手动创建 mariadb.repo仓库文件

    然后写入如下内容
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

    2.根据操作系统的不同版本,centos采用yum安装指令,ubantu采用apt-get指令安装:

    从官网安装:apt-get install MariaDB-server MariaDB-client -y

    如果中途断网,或者安装失败,可以先移除配置文件:rm -rf /etc/repos.d/Mariadb.repo

    然后清空缓存:apt-get clean all 

    3.安装完成后,启动mariadb服务端:

    systemctl  start/stop/restart/stats  mariadb

    systemctl  enable  mariadb    开机自启动

    .mysql初始化
    mysql_secure_installation 这条命令可以初始化mysql,删除匿名用户,设置root密码等等....

    设置mysql的中文编码支持,修改/etc/my.cnf
    4.vi /etc/my.cnf
    在[mysqld]中添加参数,使得mariadb服务端支持中文
    [mysqld]
    character-set-server=utf8
    collation-server=utf8_general_ci
    2.重启mariadb服务,读取my.cnf新配置
    systemctl restart mariadb
    3.登录数据库,查看字符编码
    mysql -uroot -p

    输入 s 查看编码

    ********************************************************************

    mysql常用命令
    desc 查看表结构
    create database 数据库名
    create table 表名
    show create database 库名 查看如何创建db的
    show create table 表名; 查看如何创建table结构的

    #修改mysql的密码
    set password = PASSWORD('redhat');

    #创建mysql的普通用户,默认权限非常低
    create user yining@'%' identified by 'yiningzhenshuai';

    #查询mysql数据库中的用户信息
    use mysql;
    select host,user,password from user;

    ***********************************************************************************************

    给用户添加权限命令
    grant all privileges on *.* to 账户@主机名    对所有库和所有表授权所有权限

    grant all privileges on *.* to yining@'%'; 给yining用户授予所有权限

    flush privileges; 刷新授权表

    授予远程登录的权限命令 (root不能远程登录的问题??)
    grant all privileges on *.* to yining@'%'; 给yining用户授予所有权限


    grant all privileges on *.* to root@'%' identified by 'redhat'; #给与root权限授予远程登录的命令


    此时可以在windows登录linux的数据库

    mysql -uyining -p -h 服务器的地址 连接服务器的mysql

     

  • 相关阅读:
    【乱侃】How do they look them ?
    【softeware】Messy code,some bug of Youdao notebook in EN win7
    【随谈】designing the login page of our project
    【web】Ad in security code, making good use of resource
    SQL数据库内存设置篇
    关系数据库的查询优化策略
    利用SQL未公开的存储过程实现分页
    sql语句总结
    sql中使用cmd命令注销登录用户
    SQLServer 分页存储过程
  • 原文地址:https://www.cnblogs.com/wen-kang/p/10648180.html
Copyright © 2011-2022 走看看