mysql5.6安装及配置

下载

mysql5.6官网下载地址:https://dev.mysql.com/downloads/mysql/5.6.html

不需要繁琐的安装程序,下载后解压到本地即可。

 

配置

拷贝默认my-default.ini,拷贝的一份名字修改为my.ini,用下面配置内容替换掉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]
character-set-server=utf8

# 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 = .....
# datadir = .....
# port = .....
# server_id = .....
basedir=E:\mysql-5.6.41-winx64
datadir=E:\mysql-5.6.41-winx64\data
# port=3306

character-set-server=utf8
default-storage-engine=INNODB
innodb_data_home_dir=E:\mysql-5.6.41-winx64\data
innodb_data_file_path=ibdata1:12M:autoextend
innodb_log_group_home_dir=E:\mysql-5.6.41-winx64\data

innodb_buffer_pool_size=2048M
innodb_log_file_size=4G
# 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 

简单一些的配置:

# 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]
character-set-server=utf8

# 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 = .....
# datadir = .....
# port = .....
# server_id = .....
basedir=E:\mysql-5.6.41-winx64
datadir=E:\mysql-5.6.41-winx64\data

配置文件中属性含义可参考官方文档,抑或参考该博客:https://blog.csdn.net/weixin_41004350/article/details/78492225

 

修改root密码

然后打开文件夹:C:\Windows\System32,找到cmd运行文件,右键以管理员运行。输入命令切换到mysql目录的bin目录下。

输入“mysqld -install”(如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!)。

安装成功后继续输入“net start mysql”,如果出现错误1067,那就是配置文件修改错误,确认一下配置文件是否正确。(PS:若一时找不到哪个配置除了问题可以把配置除了“basedir”和“datadir”之外全部注释掉再启动,然后一个一个放开配置项看到底哪个配置出了问题)。

接下来,修改root的密码。一般Mysql的root默认密码为空,如果你之前并没有设置过root密码就使用mysqladmin命令来修改root密码。

输入“mysqladmin -u root -p password 123456”。修改root密码为“123456”,接下来的“Enter password”直接回车即可。

然后输入“mysql -u root -p123456”即可成功连接数据库。

 

修改mysql账号密码

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值