压缩版mysql安装

    在mysql官网,有两种mysql文件。一种是msi格式,一种是zip格式,今天我们主要来讲一下zip格式解压安装的过程。笔者之前mysql无法再dos打开,想了好多办法没有解决,所以就重新安装了一下mysql。

    zip版本解压后就是一个文件夹,免安装。我们打开那个文件夹,和bin文件夹处于同一文件夹下有一个my-default.ini(有的版本是my.ini,如果都没有就新建一个my.ini文件)文件,我们需要对my-default.ini(或者my.ini)进行一些更改


我们需要将.ini文件中basedir和datadir前边的#号去掉,然后将mysql的安装路径(即bin文件夹所在的路径)以及data的路径(详细见上图)

(无my-default.ini文件的可以直接复制下方文字,新建一个my.ini拷贝进去)然后根据自己的需要修改basedir和datadir中的内容

# 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 = C:\Program Files\MySQL\mysql-5.6.24-win32
 datadir = C:\Program Files\MySQL\mysql-5.6.24-win32\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 
弄完上边的事情后我们就要配置环境了,右键我的电脑->属性->高级系统设置->环境变量

然后将mysql.exe的路径(.../bin)复制到path变量后边一定记住,是加在path变量后边而不是覆盖掉path变量,复制之前在path后边加一个";"号。

然后我们就要在dos下配置了

在开始菜单下找到命令提示符,然后右键管理员方式运行,接下来会有如下界面


扫描二维码关注公众号,回复: 11239782 查看本文章

在上边页面下输入 cd C:\Program Files\MySQL\mysql-5.6.24-win32\bin

然后输入mysqld -intall


出现Service successfully intalled说明安装成功 然后继续命令行输入net start mysql


然后输入mysql -u root -p

初始时没有密码,直接enter就可以


如果需要修改密码,进入到数据库后可以输入下方所示的命令进行修改

格式:mysql> set password for 用户名@localhost = password('新密码');
例子:mysql> set password for root@localhost = password('123');


猜你喜欢

转载自blog.csdn.net/yz_yz1234/article/details/54340346
今日推荐