mysql 去除前后空格
UPDATE sys_area_test SET areaName = TRIM(areaName);
不生效:UPDATE sys_area_test SET areaName = REPLACE(REPLACE(REPLACE(areaName,CHAR(9),''),CHAR(10),''),CHAR(13),'');
mysql修改端口号
vim /etc/mysql/mysql.conf.d/mysqld.cnf
mysql查看端口号
show global variables like 'port';
为mysql添加root远程登录权限
1)为root用户新加一个host
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'
flush privileges;
2)直接修改root用户的host
update user set host='%' where user='root';
flush privileges;
查看用户权限
show grants for user;
回收特定用户的所有权限
revoke ALL PRIVILEGES ON *.* from 'user'@'%';
revoke回收权限格式:revoke 权限列表 on 库.表 from 用户名@'ip';
revoke select,insert,update,delete ON *.* from 'user'@'%';