select user();#查看当前登录用户
flash privileges;刷新授权表
mysql -uroot -p -h 127.0.0.1 -P 3306;指定mysql客户端登录指定服务器
密码破解修改:
统一字符编码:
登录后用\s查看字符编码
mysql> \s
--------------
mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
Connection id: 21
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.22-0ubuntu0.17.10.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 47 min 14 sec
Threads: 1 Questions: 34 Slow queries: 0 Opens: 110 Flush tables: 1 Open tables: 29 Queries per second avg: 0.011
统一字符编码为utf-8
修改配置文件/etc/mysql/my.cnf
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
修改后重启服务service mysql restart,/etc/init.d/mysql restart
查看字符编码
mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
Connection id: 3
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.22-0ubuntu0.17.10.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 15 sec
Threads: 1 Questions: 5 Slow queries: 0 Opens: 107 Flush tables: 1 Open tables: 26 Queries per second avg: 0.333
--------------