mysql5 7遷移某個資料庫

2021-09-27 10:30:44 字數 1336 閱讀 4900

# 使用root管理員登陸c1伺服器的mysql資料庫

mysql -uroot -p

#查詢c1伺服器cm庫的建庫字符集等資訊

#在c2伺服器,登陸root管理員,並按照c1伺服器mysql資料庫字符集建立目標資料庫

# 檢視mysql資料庫資訊,便於資料匯出

ps -ef|

grep mysql.sock |

grep -v grep

# 匯出cm庫資料

#傳送sql檔案

scp c1:~/db_cm.sql ~/

#導入庫檔案

檢查後發現資料正確,可用。

# 檢查c1伺服器中給哪些位址的那些使用者已賦權

select host,user from mysql.user;

# 在c2伺服器的mysql中使用root管理員賦權

grant all privileges on cm.* to 'root'@'%' identified by '123456';

flush privileges;

Mysql5 7資料庫介紹

1 預設資料庫介紹 information schema 這個資料庫儲存了mysql伺服器所有資料庫的資訊。如資料庫名 資料庫的表 表欄的資料型別訪問許可權等。mysql 這個庫是系統庫,裡面儲存有賬戶資訊,許可權資訊等。performance schema 這是乙個mysql5.5開始新增的資料庫...

Centos 更改MySQL5 7資料庫目錄位置

centos7.3 安裝mysql5.7並修改初始密碼 基於 centos mysql 安裝與主從同步配置詳解 centos 通過yum安裝 rpm分發進行安裝 mysql的幾個人預設目錄如下 目錄目錄內容 usr bin 客戶端程式和指令碼 usr sbin mysqld伺服器 var lib m...

linux安裝 重灌 MySQL5 7資料庫

ubuntu16.04徹底刪除mysql5.7 刪除mysql前 先刪除一下 var lib mysql 還有 etc mysql 若有資料請先自行備份 下面命令依次執行 sudo rm var lib mysql r 刪除資料庫目錄 sudo rm etc mysql r 刪除啟動指令碼 配置檔案...