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
?
?
轉載于:https://www.cnblogs.com/wen-kang/p/10648180.html
總結
以上是生活随笔為你收集整理的linux安装mysql的分支mariadb的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Jmeter4.0----CSV Dat
- 下一篇: linux cmake编译源码,linu