回到顶部

阅读目录

mysql cannot connect(10038) 和 配置远程登录 笔记

设置密码

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');

查看编码

show variables like "%char%";

show variables like "%character%";

show variables like "%collation%";

对于 mysql 配置文件

1、utf-8 和 utf8 字符是不同的,mysql 用 utf8

2、client、mysql 设置应该放在 mysqld(放参数的) 前面 或者最后面去

默认的:

设置UTF-8编码

Latin1 是 ISO-8859-1 的别名,有些环境下写作 Latin-1。ISO-8859-1 编码是单字节编码,向下兼容 ASCII。

字符编码为 latin1 时,用户在给数据表插入一条字符类型(char)的记录,在显示此记录时可能会无法正常显示字符类型的数据,故此处我们将 mysql 字符编码修改为UTF8。

ubantu 配置文件位置

vi /etc/mysql/mysql.conf.d/mysqld.cnfcd cd

centos:

[root@localhost mysql-server-5.1.73]# ls

my-huge.cnf my-innodb-heavy-4G.cnf my-large.cnf my-medium.cnf my-small.cnf

期望结果

允许其他机器登录

vi /etc/mysql/mysql.conf.d/mysqld.cnf

# bind-address          = 127.0.0.1  #注释掉

create table students (id int primary key auto_increment , name char(10),age int(3));

select User,Password,Host from user;

mysql 报错错误 10038

mysql 远程访问 cannot connect(10038)  就是没有远程登录权限

允许 root 用户远程登录

执行语句

GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'password' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'root' WITH GRANT OPTION;

重启

sudo /etc/init.d/mysql restart 

^_^
请喝咖啡 ×

文章部分资料可能来源于网络,如有侵权请告知删除。谢谢!

前一篇: django 多级分类,一个 model 搞定
下一篇: Django 数据查询中对字段进行排序
captcha