# mysql -u root -p > USE mysql; > SELECT User, Host, plugin FROM mysql.user; > UPDATE user SET plugin='mysql_native_password' WHERE User='root'; > UPDATE user SET password =PASSWORD('foobar') WHERE user = 'root'; // MariaDB 10 > SET PASSWORD FOR 'root'@'localhost' = PASSWORD('foobar'); > FLUSH PRIVILEGES; # /etc/init.d/mysql restart
[ 匯出資料或架構Schema ]
mysqldump -u root -p databaseX > dbX_dump.sql mysqldump -u root -p databaseX --no-data > dbX_dump.sql
[ 帳戶權限操作 ]
權限設成 localhost 僅限從 mysql server 本機登入,反之權限設定為 % 代表可從任何遠端主機連入;在 mysql 系統上兩個帳號視為不同且可並存。
select user,host from mysql.user; create user 'jack'@'localhost' identified by 'NEW_PASSWORD'; create user 'jack'@'%' identified by 'NEW_PASSWORD';
設定遠端連入:/etc/mysql/mariadb.conf.d/50-server.cnf
bind-address = 0.0.0.0
沒有留言:
張貼留言