Mysql 8 0版本以上建立使用者及授權

2021-10-08 08:19:03 字數 503 閱讀 8869

建立使用者:create user 'dba'@'%' identified by 'mypass@123';

授權:grant all privileges on *.* to 'dba'@'%'; 

設定密碼:alter user 'dba'@'%' identified with mysql_native_password by 'mypass@123';

重新整理許可權:flush privileges;

修改root使用者密碼:update user set password = password('newpass') where user = 'root';

丟失root密碼:在my.cnf配置檔案中mysqld_safe下新增 --skip-grant-tables,重啟服務後就可以免密登入,然後執行:update user set password=password("new password") where user='root',刪掉配置中 --skip-grant-tables,重啟服務就可以了;

MySql8 0以上版本安裝

1 配置環境變數 變數名 mysql home 變數值 mysql存放路徑 例如 d mysql 8.0.20 winx64 2 生成data檔案 以管理員身份執行cmd 進入d mysql 8.0.20 winx64 bin下 執行命令 mysqld initialize insecure use...

本地安裝mysql8 0以上版本

2.解壓zip包,並將解壓檔案放入乙個資料夾下 3.配置環境變數 目的是為了避免在cmd視窗下操作時反覆切換路徑 4.在安裝根目錄下新增 my.ini檔案 data資料夾是初始化資料庫之後才有的,my.ini檔案預設是沒有的,自己可以編寫如下 mysqld 設定3306埠 port 3306 設定m...

搭建mysql8 0版本

本次採用yum構建mysql8.0資料庫,具體操作步驟如下 wget c 安裝mysql8.0 yum源 rpm ivh mysql80 community release el7 3.noarch.rpm 安裝mysql8.0資料庫 yum install y mysql community se...