備份
mysqldump -u root -p dbname -> dbname.sql
還原
mysql -u root -p dbname <- dbname.sql
如果記憶體夠大的話,可以嘗試設定以下的參數來優化資料庫的速度(資料數量極大的情況下)
key_buffer_size = 160000M
max_allowed_packet = 160000M
thread_stack = 192000K
thread_cache_size = 64
query_cache_limit = 1000M
query_cache_size = 160000M
mysqldump -u root -p dbname -> dbname.sql
還原
mysql -u root -p dbname <- dbname.sql
如果記憶體夠大的話,可以嘗試設定以下的參數來優化資料庫的速度(資料數量極大的情況下)
key_buffer_size = 160000M
max_allowed_packet = 160000M
thread_stack = 192000K
thread_cache_size = 64
query_cache_limit = 1000M
query_cache_size = 160000M
使用root進入cmd line後
GRANT ALL ON dbname.* TO 'user'@localhost IDENTIFIED BY 'passwd' WITH GRANT OPTION; //localhost適用
GRANT ALL ON dbname.* TO 'user'@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION; //開啟所有IP能連線適用
FLUSH PRIVILEGES;
GRANT ALL ON dbname.* TO 'user'@localhost IDENTIFIED BY 'passwd' WITH GRANT OPTION; //localhost適用
GRANT ALL ON dbname.* TO 'user'@'%' IDENTIFIED BY 'passwd' WITH GRANT OPTION; //開啟所有IP能連線適用
FLUSH PRIVILEGES;