安裝mysqlmysql
- yum remove mariadb-libs.x86_64 移除mariadb-libs.x86_64
- cd /tmp/
- wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm 下載mysql源
- yum localinstall mysql57-community-release-el7-11.noarch.rpm 安裝源
- yum install -y mysql-community-server 安裝mysql
- ps -ef | grep mysql 查看mysql服務是否啓動
- service mysqld restart 重啓mysql服務
- cat /var/log/mysqld.log | grep password 查找mysql的默認安裝密碼
- mysql -uroot -p密碼 進入mysql服務
- SET PASSWORD = PASSWORD(‘新密碼’) 重置密碼
開啓數據庫遠程鏈接sql
- mysql -h127.0.0.1 -uroot -p 進入數據庫
- show databases;查看數據庫
- use mysql 進入mysql這個數據庫
- show tables; 查看錶
- select Host,User from user \G;
- update user set Host =’%’ where Host=’localhost’ and User=’user’;
- flush privileges;刷新權限
- service firewalld stop; 關閉防火牆
開啓 genelog數據庫
- mysql -uroot -p 進入數據庫
- set global general_log_file=」/tmp/general.log」;
- set global general_log=on;
忘記root密碼spa
在/etc/my.cnf 加入 skip-grant-tables;rest
重啓mysql服務server
mysql -uroot -pip
use mysqlrem
update user set authentication_string=password(‘456789’) where user=’root’;get