mysql5.6版本安装步骤详解
2015-12-17 19:16
876 查看
mysql5.0之后的版本与之前的版本有一些区别,我们在安装的时候如果用安装老版本的方法会遇到各种问题,其中最主要的区别就是配置文件my.cnf
详细安装步骤这里就不多说了,与老版本的安装步骤一样的,如有需要可以参考笔者另外一篇博文
这里主要讲解配置文件的不同之处,我们在安装过程中,到了要拷贝配置文件的那一步会遇到错误,我们会发现在目录/usr/local/mysql/support-files/(该路径可以自己定义)下没有my_large.cnf这个配置文件,只有my.cnf或者my-default.cnf,而且其中的内容又与我们原来使用的my_large.cnf很不一样,那么怎么办呢?
下面来看看我的配置文件内容:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
user=mysql
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
# server_id = .....
# socket = .....
character-set-server=utf8
init_connect='SET NAMES utf8'
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
原来的配置文件中基本只有被注释的内容,我们需要自己去手动修改。默认情况下,mysql建立数据库和表时使用的编码为latin1,不能使用中文,需要修改配置文件my.cnf。
在my.cnf下找到[client]模块,
添加如下文字:
default-character-set=utf8
在my.cnf下找到[mysql]模块,
添加如下文字:
default-character-set=utf8
在my.cnf下找到[mysqld]模块,
添加如下文字:
character-server-set=utf8
init_connect=utf8
注意上述必须是character-server-set=utf8,不能是default-character-set=utf8,否则会出错。
最重要的是其中目录和端口的设置,这几行原来是被注释掉的,我们需要将注释去掉,加上我们自定义的内容,还要在mysqld模块中指定我们数据库的属主。
本文出自 “奇迹的少年” 博客,请务必保留此出处http://raffaelexr.blog.51cto.com/8555551/1725794
详细安装步骤这里就不多说了,与老版本的安装步骤一样的,如有需要可以参考笔者另外一篇博文
这里主要讲解配置文件的不同之处,我们在安装过程中,到了要拷贝配置文件的那一步会遇到错误,我们会发现在目录/usr/local/mysql/support-files/(该路径可以自己定义)下没有my_large.cnf这个配置文件,只有my.cnf或者my-default.cnf,而且其中的内容又与我们原来使用的my_large.cnf很不一样,那么怎么办呢?
下面来看看我的配置文件内容:
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
user=mysql
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3306
# server_id = .....
# socket = .....
character-set-server=utf8
init_connect='SET NAMES utf8'
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
原来的配置文件中基本只有被注释的内容,我们需要自己去手动修改。默认情况下,mysql建立数据库和表时使用的编码为latin1,不能使用中文,需要修改配置文件my.cnf。
在my.cnf下找到[client]模块,
添加如下文字:
default-character-set=utf8
在my.cnf下找到[mysql]模块,
添加如下文字:
default-character-set=utf8
在my.cnf下找到[mysqld]模块,
添加如下文字:
character-server-set=utf8
init_connect=utf8
注意上述必须是character-server-set=utf8,不能是default-character-set=utf8,否则会出错。
最重要的是其中目录和端口的设置,这几行原来是被注释掉的,我们需要将注释去掉,加上我们自定义的内容,还要在mysqld模块中指定我们数据库的属主。
本文出自 “奇迹的少年” 博客,请务必保留此出处http://raffaelexr.blog.51cto.com/8555551/1725794
相关文章推荐
- 阿里云 Ubuntu 14.04 安装mysql 5.6
- MySQL 5.7 新特性详解
- mysql 安装问题
- mysql insert_select ID 自增长
- MySQL 忘记密码后的重置操作
- Mysql String Functions
- mysql5.6源码安装
- mysql Table 'performance_schema.session_variables' doesn't exist
- mysql复制
- MySQL安装包
- Mysql安装步骤
- mysql 安装与配置
- 老李分享:loadrunner操作mysql数据库
- mysql 基于LVM快照的备份
- 老李分享:MySql的insert语句的性能优化方案
- sqlsever,mysql,orcale,判断null值方法
- ubuntu15.04 C客户端操作mysql
- MySQL配置文件my-innodb-heavy-4G.cnf 中文注释
- mysql 去除重复记录
- Mysql备份还原数据库之mysqldump实例及参数详细说明