安裝依賴
shell> wget
# 安裝 mysql 源
shell> yum localinstall mysql57-community-release-el7-11.noarch.rpm
用下面的命令檢查 mysql 源是否安裝成功
shell> yum repolist enabled | grep "mysql.*-community.*"
啟動 mysql
yum install -y mysql-community-server
啟動 mysql。 關閉命令是(systemctl start|stop
)
systemctl start mysqld
檢視mysql 狀態
systemctl status mysqld
設定開機自啟動
systemctl enable mysqld
# 過載所有修改過的配置檔案
systemctl daemon-reload
生成密碼
grep 'password' /var/log/mysqld.log
設定密碼
登入 mysql
mysql -uroot -p
設定密碼
alter user 'root'@'localhost' identified by 'abcdef123!';
新增乙個允許遠端連線的帳戶
grant all privileges on *.* to 'ganyuhui'@'%' identified by 'abcdef123!' with grant option;
允許 root 遠端鏈結
use mysql;
update user set host='%' where user='root';
flush privileges;
設定預設編碼為 utf8
vim /etc/my.cnf
# 新增配置
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
重啟 mysql 服務
systemctl restart mysqld
centos 7 安裝MySQL 筆記
1.安裝 wget rpm ivh mysql community release el7 5.noarch.rpm yum install mysql community server 成功安裝之後重啟mysql服務 service mysqld restart 初次安裝mysql是root賬戶是...
centos7離線安裝mysql
選擇red hat enterprise linux 7 oracle linux 7 把os的版本選擇為all 安裝之前先解除安裝自帶的mysql 搜尋mysql的rpm包 rpm qa grep i mysql rpm qa grep i mariadb刪除mysql rpm e mariadb...
CentOS7安裝MySql指南
1 通過 rpm qa grep mariadb 命令檢視 mariadb 的安裝包 2 通過 rpm e mariadb libs 5.5.56 2.el7.x86 64 nodeps 命令裝卸 mariadb 3 通過 cd usr local 命令進入根目錄下的usr目錄下的local目錄,並...