Debian之MySQL
debian9 安裝任意版本mysql
debian安裝及使用mysql
debian8安裝mysql(MariaDB)
在Fedora和RedHat以及CentOS中 源碼編譯安裝MySQL5.6.12詳細過程
mysql-server 與 mysql-client
mysql-server 與 mysql-client是DBMS的兩個面向不同操作對象的工具。
server是DBMS面向物理層次,包含存儲數據的一系列機制、處理方法的集成;
client是DBMS面向用戶,提供一系列工具為用戶所用,這些工具包括通常寫的sql在內都要通過server的編譯才能操作物理數據。
mysql-server是服務端,也就是說,你服務端沒安裝,客戶端沒對象去操作,就好比,你買了個西瓜刀,但是卻沒買西瓜。。。。切西瓜有很多工具,西瓜刀只是其中一種
介紹幾個主流mysql圖形化客戶端,navicat,phpmyadmin
rpm包安裝完後自動將mysql安裝成系統服務,所以可以使用下面命令啟動、停止mysql
啟動mysql
/etc/init.d/mysql start 或 service mysql start
相關目錄
工具程序(mysqladmin mysqldump等命令)在/usr/bin目錄中---ls /usr/bin/mysql*
服務器程序/usr/sbin/mysqld
數據目錄 /var/lib/mysql
錯誤日誌文件、二進制日誌文件及進程文件寫在/var/lib/mysql目錄中
mysql.server命令及配置文件 /usr/share/mysql
配置
root@localhost:/etc/mysql# ls
conf.d debian-start mariadb.conf.d my.cnf.fallback
debian.cnf mariadb.cnf my.cnf
配置說明
/etc/my.cnf文件中說明
# The MariaDB configuration file
#
# The MariaDB/MySQL tools read configuration files in the following order:
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
查看服務當前狀態 systemctl命令
systemctl status mysql.service
主要配置
sudo mysql_secure_installation
- Enter current password for root (enter for none): (第一次沒有密碼)
- Set root password? [Y/n] y (設置 root 密碼)
- Remove anonymous users? [Y/n] y (移除匿名賬戶)
- Disallow root login remotely? [Y/n] y (禁用 root 遠程登錄)
- Remove test database and access to it? [Y/n] y (刪除 test 數據庫和訪問權限)
- Reload privilege tables now? [Y/n] y (刷新權限)
show databases; 顯示數據庫
show tables; 顯示數據庫中的表
describe 表名; 顯示數據表的結構:
create database 表名; 建數據庫
/etc/init.d/mysql start 啟動
service mysql stop 關停mysql服務
/usr/bin/mysqladmin -u root -p shutdown 停止
service mysql restart 重啟mysql服務
/var/lib/mysql MySQL默認的數據文件存儲目錄
Debian之MySQL