mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
show variables like "%char%";
show variables like "%character%";
show variables like "%collation%";
1、utf-8 和 utf8 字符是不同的,mysql 用 utf8
2、client、mysql 设置应该放在 mysqld(放参数的) 前面 或者最后面去
默认的:
Latin1 是 ISO-8859-1 的别名,有些环境下写作 Latin-1。ISO-8859-1 编码是单字节编码,向下兼容 ASCII。
字符编码为 latin1 时,用户在给数据表插入一条字符类型(char)的记录,在显示此记录时可能会无法正常显示字符类型的数据,故此处我们将 mysql 字符编码修改为UTF8。
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 远程访问 cannot connect(10038) 就是没有远程登录权限
执行语句
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