MySQL 远程访问问题
1.sudo vim mysql.conf.d/mysqld.cnf 注掉 #bind-address = 127.0.0.1
2.登陆进入mysql-server:/etc/mysql$ mysql -uroot -p
Enter password:
mysql> use mysql
mysql> update user set Host = ‘%‘ where user = ‘root‘;
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘lixiul‘ WITH GRANT OPTION; //授权来自任何机器 可以以用户名root,密码lixiul登陆mysql服务器
FLUSH PRIVILEGES; //保存修改
3. service mysql restart //重启mysql服务
MySQL 中文乱码问题
1 修改/etc/mysql/my.cnf添加如下内容
[mysqld]
character-set-server=utf8
[mysql.server]
default-character-set=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf82 重启mysqlservice mysql restart3 进入mysqlmysql> SHOW VARIABLES LIKE ‘character_%‘;
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql>
另外如果你想更好的提升你的编程能力,学好C语言C++编程!弯道超车,快人一步!笔者这里或许可以帮到你~
欢迎转行和学习编程的伙伴,利用更多的资料学习成长比自己琢磨更快哦!
编程学习: