02.29 CentOS 7

MariaDB數據庫管理系統是MySQL的一個分支,主要由開源社區在維護,採用GPL授權許可。

MariaDB服務

查詢MariaDB

<code>yum info mariadbyum info mariadb-server/<code>

安裝和配置MariaDB服務

<code>yum install mariadb-server -ysystemctl start mariadbsystemctl enable mariadbsystemctl status mariadbmysql_secure_installation# Follow the instruction ... .../<code>

查詢socket statistics狀態(TCP 3306)

<code>ss -antp | grep mysqld/<code>

配置防火牆例外

<code>firewall-cmd --permanent --add-service=mysqlfirewall-cmd --reloadfirewall-cmd --list-services/<code>

數據庫維護

基本操作

<code>mysql -u root -pcreate database myDB;show databases;grant all privileges on myDB.* to myDBowner@'%' identified by 'MyPassword';grant select on myDB.* to myDBread@'%' identified by 'MyPassword';flush privileges;show grants for myDBowner;/<code>

備份數據庫

<code>mkdir /backupmysqldump -uroot -pMyPassword myDB | gzip > /backup/myDB.sql.gzls /backup/<code>

恢復數據庫

<code>cd /backupgunzip myDB.sql.gzlscat myDB.sql | mysql -uroot -pMyPassword myDB/<code>

備份數據庫腳本

<code>#/bin/bashsub_folder=$(date +%Y%m%d)cd /backupmkdir $sub_folderbackup_file=/backup/$sub_folder/myDB.sql.gzmysqldump -uroot -pMyPassword myDB | gzip > $backup_file/<code>

MariaDB 10.1數據庫連結問題(高版本)

報錯:Host is not allowed to connect to this MariaDB server

<code> UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root' AND host = 'localhost';/<code>

安裝phpMyAdmin

<code># 安裝Apacheyum install httpd -ysystemctl status httpdsystemctl start httpdsystemctl enable httpdfirewall-cmd --permanent --add-service=httpfirewall-cmd --reloadfirewall-cmd --list-service# 安裝phpMyAdminyum install epel-release -yyum install phpmyadmin -y/<code>

訪問http://xxx.xxx.xxx.xxx/phpMyAdmin

報錯:You don't have permission to access /phpmyadmin on this server.

修改配置文件vi /etc/httpd/conf.d/phpMyAdmin.conf

<code>Require ip 127.0.0.1 192.168.10.100# 允許192.168.10.100通過Web訪問和配置MariaDB服務器/<code>

重啟httpd服務

<code>systemctl restart httpd/<code>


分享到:


相關文章: