Mysql 5.7.* 免安装版配置

来源:互联网 发布:淘宝众筹怎么进 编辑:程序博客网 时间:2024/09/21 09:28
  • Mysql 5.7版本为跨度比较大的一个版本,安装配置较之前版本有些不同

  • 以下版本为Mysql 5.7.13


1. 从Mysql官网下载Mysql,解压至任意目录

2. 在根目录下新建my.ini,粘贴以下内容

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/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[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:\Program Files (x86)\MySQL 5.7.13datadir = D:\Program Files (x86)\MySQL 5.7.13\dataport = 3306character-set-server = utf8default-storage-engine = INNODBlog-error=D:\Program Files (x86)\MySQL 5.7.13\data\mysql_error.log# 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.max_connections = 100table_open_cache = 256query_cache_size = 1Mtmp_table_size = 32Mthread_cache_size = 8innodb_data_home_dir = "D:\Program Files (x86)\MySQL 5.7.13\data"innodb_flush_log_at_trx_commit = 1innodb_log_buffer_size = 128Minnodb_buffer_pool_size = 128Minnodb_log_file_size = 10Minnodb_thread_concurrency = 16innodb-autoextend-increment = 1000join_buffer_size = 128Msort_buffer_size = 32Mread_rnd_buffer_size = 32Mmax_allowed_packet = 32Mexplicit_defaults_for_timestamp=truesql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

3.修改环境变量

在path中添加 %MYSQL_HOME%\bin;

%MYSQL_HOME%为mysql解压目录。

4.初始化data目录

mysqld --initialize-insecure

5.6版本以前自带Data目录,不需要这一步。而5.7版本如果没有这一步会无法启动mysql服务。

mysqld –initialize-insecure 自动生成无密码的root用户。

mysqld –initialize 是自动生成随机密码用户。

5.注册Mysql服务

mysqld --install MySQL --defaults-file="%MYSQLHOME%\my.ini"

移除安装:mysqld remove;

6.启动Mysql服务

net start mysql

关闭服务:net stop mysql

7.修改root账号的密码

mysql -u root -pSET PASSWORD = PASSWORD('你的新密码');

在 Mysql 5.7.13 中, 系统的 user 表中没有 password 这一列了, 所以Mysql 5.6.* 直接用 update 语句来更新root密码的方法不可用了, 我们只能用 SET PASSWORD = PASSWORD(‘你的新密码’); 来修改密码。

修改完密码之后, 需要重启 MySQL 服务才生效。

0 0
原创粉丝点击