如何设置远程连接:
登录到MySQL服务器端,在mysql库下执行:
grant all privileges on . to ‘username’@’%’ identified by ‘password’ with grant option;
修改密码
mysql5.7以前:
update user set password=password(‘newPassword’) where user=’root’;
mysql5.7:
- update user set authentication_string=password(‘newPassword ‘) where user=’root’;
- #或者
alter user ‘root’@’localhost’ identified by ‘newpassword’;
查看MySQL的字符集设置
show global variables like “%character%”;
改变
- SET global character_set_client=’utf8’;
- SET global character_set_server=’utf8’;
- SET global character_set_database=’utf8’;
- SET global character_set_connection=’utf8’;
- SET global character_set_results=’utf8’;
- SET global character_set_client=’utf8mb4’;
- SET global character_set_server=’utf8mb4’;
- SET global character_set_database=’utf8mb4’;
- SET global character_set_connection=’utf8mb4’;
SET global character_set_results=’utf8mb4’;
创建用户:
create user ‘username’@’%’ identified by ‘password’;
新增授权:
grant select, insert, update, references, delete, create, drop, alter, index, trigger, create view, show view, execute, alter routine, create routine, create temporary tables, lock tables, event on
database_name.* to ‘username’@’%’;修改授权:
revoke select, insert, update, references, delete, create, alter, index, trigger, create view, show view, execute, alter routine, create routine, create temporary tables, lock tables, event on
database_name.* from ‘username’@‘%’;删除用户:
-
创建用户:
GRANT USAGE ON . TO ‘username’@’%’ IDENTIFIED BY ‘password’
- WITH MAX_QUERIES_PER_HOUR 0
- MAX_UPDATES_PER_HOUR 0
- MAX_CONNECTIONS_PER_HOUR 0;
- GRANT Create Routine, Insert, Lock Tables, References, Select, Drop, Delete, Index, Alter Routine, Create View, Create Temporary Tables, Show View, Trigger, Event, Create, Update, Execute, Alter ON
database name.* TOusername@%;
