最近刚刚在win7系统安装了mysql客户端数据库,现整理步骤供大家学习交流!
一、下载mysql安装包
安装包名称:mysql-5.6.12-win32.zip
下载地址:http://dev.mysql.com/downloads/mysql/
(网盘分享:https://yunpan.cn/ckRxP5HBQ58ak 访问密码 d8e0)
二、安装mysql
2.1 修改配置文件my.ini (将此文件放入安装的目录下)
将mysql-5.6.12-win32.zip解压拷贝到D:\
修改D:\mysql-5.6.12-win32.zip目录下的配置文件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. [client]
default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld]
character-set-server=utf8
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# 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.-winx64
datadir = D:/mysql-5.6.-winx64/data
# port = .....
# server_id = ..... # 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
2.2 安装mysql
以管理员身份启动cmd,切换到目录D:/mysql-5.6.12-win32/bin
安装mysql:mysqld.exe --install(CMD中执行后,如果报拒绝,则需要用管理员权限运行CMD,然后执行该命令)
三、启动mysql服务
3.1 启动mysql服务
以管理员身份启动cmd,切换到目录D:/mysql-5.6.12-win32/bin
启动mysql服务:net start MySQL
(若想在cmd命令中直接运行指令,而不用进入bin目录下,需要在环境变量中增加路径,如图:
)
PS:系统默认的Mysql是自启动的,修改为手工启动的方法:
进入本机的“服务”,修改为手动启动即可,如图:
四、执行命令
4.1 登录mysql
mysql -u root -p
输入密码(密码为空,直接回车),即可登录。
修改root密码为123456:
mysql> use mysql; Database changed mysql> UPDATE user SET password=PASSWORD("123456") WHERE user='root';
4.2 执行mysql命令
五、卸载mysql
4.1 停止mysql服务
net stop MySQL
4.2 卸载mysql
mysqld.exe --remove