MySQL中my.ini文件配置 5
2、my.ini代码是否有错
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-
defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied
to the
# *** default location during install, and will be replaced if
you
# *** upgrade to a newer version of MySQL.
[mysqld]
# 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 =D:/mysql-5.6.14-win32
datadir = D:/mysql-5.6.14-win32/data
port = 3306
# server_id = .....
character-set-server=utf8
default-character-set=utf8
default-storage-engine=INNODB
max_connections=100
query_cache_size=0
table_cache=256
tmp_table_size=35M
thread_cache_size=8
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=69M
key_buffer_size=55M
read_rnd_buffer_size=256k
sort_buffer_size=256k
# 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
,NO_AUTO_CREATE_USER
[client]
port=3306
[mysql]
default-character-set=utf8
[WinMySQLAdmin]
Server=D:/mysql-5.6.14-win32/bin/mysqld.exe
3、my.ini文件是不是放在mysql-5.6.14-win32文件夹中? 展开
1、在我们的电脑上面找到mysql的安装路径,点击进去。
2、进去之后可以看到my.ini在mysql安装路径的根目录,这是其中一种情况。
3、另外一种情况是我们在mysql安装目录找不到,看到了my-default.ini文件,这时my.ini在“C:\ProgramData\MySQL\MySQL Server 5.6”目录下面,我们首先需要找到ProgramData文件夹,这是一个隐藏文件,需要隐藏文件可见才行,或者可以直接检索。
4、我们可以看到在“C:\ProgramData\MySQL\MySQL Server 5.6”目录下面找到了my.ini文件。
5、我们右键my.ini文件,选择打开方式,可以通过记事本和其他文本编辑器打开。
6、我们可以看到my.ini的文件打开了。
1、查找my.ini位置,可通过windows服务所对应mysql启动项,查看其对应属性->可执行文件路径,获取my.ini路径。
"D:\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="D:\MySQL Data\my.ini" MySQL55
2、编辑my.ini中对应datadir
改前:datadir="D:\MySQL Data\data\"
改后:datadir="D:\MySQL Data\MySQL Server 5.5\data\"
3、重整mysql对应数据文件目录(若不做,则mysql无法正常启动)
4、查找注册表,修改mysql启动项所关联的defaults-file路径:
KEY_LOCAL_MACHINE/SYSTEM/Services/MySQL55
修改完后,刷新windows服务,再次查看mysql启动项属性->可执行文件路径,结果如下:
"D:\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="D:\MySQL Data\MySQL Server 5.5\my.ini" MySQL
确保将my.ini移植到正确的目录下。
5、重启mysql,配置成功。
# These are commonly set, remove the # and set as required.
basedir =D:/mysql-5.6.14-win32
datadir = D:/mysql-5.6.14-win32/data
port = 3306
# server_id = .....
character-set-server=utf8
default-character-set=utf8(该句有问题,需屏蔽)
default-storage-engine=INNODB
max_connections=100
倒数第二行 Server=D:/mysql-5.6.14-win32/bin/mysqld.exe 不是mysqld-nt.exe 保持一致就可以了
肉眼没看出啥错误
原则上是在安装目录中的
可以百度一下mysql 教程 有详细的图文教程
重新安装之前 务必卸载干净 注册表也要清理干净
MySQL云数据库创建、配置与使用教程,五秒钟创建属于自己的mysql云数据库,申请地址:xmjar.cn