Mysql默認安裝的時候,是不支持遠程鏈接的java
mysql -u root -p mysql> use mysql; mysql> update user set host = ’%’ where user = ’root’; mysql> select host, user from user; mysql> flush privileges;
GRANT ALL PRIVILEGES ON *.* TO ’root’@’%’ IDENTIFIED BY ’mypassword’ WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO ’root’@’192.168.0.1’ IDENTIFIED BY ’mypassword’ WITH GRANT OPTION;
Mysql安裝完成後,修改默認字符集;Mysql8.0以後默認的字符集爲utf8,無需修改;該方案針對mysql5.7版本.mysql
(注意:重啓mysql後,配置失效)sql
# 查看系統中的字符集 show VARIABLES LIKE 'CHARACTER%' # 將系統中的字符集都修改成utf-8 set character_set_client=utf8; set character_set_connection=utf8; set character_set_database=utf8; set character_set_results=utf8; set character_set_server=utf8;
(永久修改的方式,推薦)bash
[mysql] default-character-set=utf8 [mysqld] character-set-server=utf8