日期:2014-05-16 浏览次数:20559 次
1、数据库目录 /var/lib/mysql/,这里的mysql相当于windows下mysql的date文件夹 2、配置文件 /usr/share/mysql(mysql.server命令及配置文件) 3、相关命令 /usr/bin(mysqladmin mysqldump等命令) 4、启动脚本 /etc/init.d/mysql start
1)find / -iname *.cnf -print 2)cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
在linux下修改mysql的配置文件my.cnf(vi /etc/my.cnf)文件位置默认/etc/my.cnf文件 找到客户端配置[client] 在下面添加 default-character-set=utf8 默认字符集为utf8 再找到[mysqld] 添加 default-character-set=utf8 默认字符集为utf8 或者 character-set-server=utf8 【注】:default-character-set和character-set-server的这两种写法要依据MySQL的不同版本而定。在5.5下default-character-set=utf8会报错。Starting MySQL..The server quit without updating PID file init_connect='SET NAMES utf8' (设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)
修改好后,重新启动mysql ( service mysql restart 或者执行:sudo /etc/init.d/mysql stop 然后sudo /etc/init.d/mysql start) 即可,查询一下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/ | +--------------------------+----------------------------+