mysql安裝,遠程鏈接,以及修改密碼

                  安裝mysqlmysql

  1. yum remove mariadb-libs.x86_64 移除mariadb-libs.x86_64
  2. cd /tmp/
  3. wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm  下載mysql源
  4. yum localinstall mysql57-community-release-el7-11.noarch.rpm 安裝源
  5. yum install  -y  mysql-community-server 安裝mysql
  6. ps -ef | grep mysql 查看mysql服務是否啓動
  7. service mysqld restart 重啓mysql服務
  8. cat /var/log/mysqld.log | grep password 查找mysql的默認安裝密碼
  9. mysql -uroot -p密碼 進入mysql服務
  10. SET PASSWORD = PASSWORD(‘新密碼’)  重置密碼

開啓數據庫遠程鏈接sql

  1. mysql -h127.0.0.1 -uroot -p 進入數據庫
  2. show databases;查看數據庫
  3. use mysql 進入mysql這個數據庫
  4. show tables; 查看錶
  5. select Host,User from user \G;
  6. update user set Host =’%’ where Host=’localhost’ and User=’user’;
  7. flush privileges;刷新權限
  8. service firewalld stop; 關閉防火牆

開啓 genelog數據庫

  1. mysql -uroot -p 進入數據庫
  2. set global general_log_file=」/tmp/general.log」;
  3. 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

相關文章
相關標籤/搜索