您的位置:首页 > 数据库 > MySQL

mysql字符集以及访问权限

2015-11-05 16:31 471 查看
Liunx下修改MySQL字符集:

1.查找MySQL的cnf文件的位置

find / -iname '*.cnf' -print

/usr/share/mysql/my-innodb-heavy-4G.cnf

/usr/share/mysql/my-large.cnf

/usr/share/mysql/my-small.cnf

/usr/share/mysql/my-medium.cnf

/usr/share/mysql/my-huge.cnf

/usr/share/texmf/web2c/texmf.cnf

/usr/share/texmf/web2c/mktex.cnf

/usr/share/texmf/web2c/fmtutil.cnf

/usr/share/texmf/tex/xmltex/xmltexfmtutil.cnf

/usr/share/texmf/tex/jadetex/jadefmtutil.cnf

/usr/share/doc/MySQL-server-community-5.1.22/my-innodb-heavy-4G.cnf

/usr/share/doc/MySQL-server-community-5.1.22/my-large.cnf

/usr/share/doc/MySQL-server-community-5.1.22/my-small.cnf

/usr/share/doc/MySQL-server-community-5.1.22/my-medium.cnf

/usr/share/doc/MySQL-server-community-5.1.22/my-huge.cnf

2. 拷贝 small.cnf、my-medium.cnf、my-huge.cnf、my-innodb-heavy-4G.cnf其中的一个到/etc下,命名为my.cnf

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

3. 修改my.cnf

vi /etc/my.cnf

在[client]下添加

default-character-set=utf8

在[mysqld]下添加

default-character-set=utf8

4.重新启动MySQL

service mysqld restart;

mysql中给root赋予访问权限

mysql -uroot -p0127 //登录mysql

grant all privileges on *.* to 'root'@'%' with grant option
//赋予任何主机访问数据的权限

flush privileges //修改生效

exit //退出

service mysqld restart //重启mysql服务
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: