Linux下解除安裝安裝mysql
1、解除安裝命令:# rpm -qa |grep -i mysql
# yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common
2、安裝:# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# yum localinstall mysql57-community-release-el7-8.noarch.rpm
# yum install mysql-community-server
3、啟動 :# systemctl start mysqld
重啟:# systemctl restart mysqld
關閉:# systemctl stop mysqld
設定開機自啟 # systemctl enable mysqld
# systemctl daemon-reload
4、檢視預設密碼:# grep 'temporary password' /var/log/mysqld.log
注:可修改密碼策略(不然密碼需要包括大小寫、數字、特殊符號)
# vim /etc/my.cnf
新增:validate_password = off
# systemctl restart mysqld
5、登入:# mysql -uroot -p
修改密碼:mysql> set password for 'root'@'localhost'=password('123123');
新增遠端賬號:mysql> GRANT ALL PRIVILEGES ON *.* TO 'home'@'%' IDENTIFIED BY '123123' WITH GRANT OPTION;
7、配置預設編碼utf-8:# vim /etc/my.cnf
新增: character_set_server=utf8
init_connect='SET NAMES utf8'
8、預設配置檔案路徑:
配置檔案:/etc/my.cnf
日誌檔案:/var/log//var/log/mysqld.log
服務啟動指令碼:/usr/lib/systemd/system/mysqld.service
socket檔案:/var/run/mysqld/mysqld.pid