mysql5.7.14免安装注意事项

1、解压

2、在目录D:\Program Files\mysql-5.7.14-winx64下复制my-default.ini,放在与其相同目录下,名称显示为my.ini;

3、编辑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\mysql-5.7.14-winx64
 datadir = D:\Program Files\mysql-5.7.14-winx64\data
 tmpdir = D:\Program Files\mysql-5.7.14-winx64\data
 socket = D:\Program Files\mysql-5.7.14-winx64\data\mysql.sock
 port = 3306
# server_id = .....

max_connections = 100
table_open_cache = 256
query_cache_size = 1M

tmp_table_size = 32M
thread_cache_size = 8

innodb_data_home_dir = D:\Program Files\mysql-5.7.14-winx64\data
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 128M
innodb_buffer_pool_size = 128M
innodb_log_file_size = 10M
innodb_thread_concurrency = 16
innodb-autoextend-increment = 1000


# 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 

join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M

max_allowed_packet = 32M
explicit_defaults_for_timestamp = true

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

4、在解压目录D:\Program Files\mysql-5.7.14-winx64下新建data文件(不用在文件夹做其他操作)

5、以管理员身份进入cmd界面(必须是管理员)

6、切换至mysql解压目录\bin下,初始化data目录

输入命令:mysqld --initialize-insecure (生成无密码的root用户)

或:mysqld --initialize(生成带随机密码的root用户)

7、初始化完成后启动mysql服务

输入命令:net start mysql

8、开始使用mysql

输入命令:mysql -u root -p

9、停止mysql服务

输入命令:net stop mysql

10、忘记root密码后如何登录

  101、 关闭正在运行的MySQL服务。 
  10.2、 打开DOS窗口,转到mysql\bin目录。 
  10.3、输入mysqld --skip-grant-tables 回车。--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。 
  10.4、再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录。 
  10.5、输入mysql回车,如果成功,将出现MySQL提示符 >。 
  10.6、连接权限数据库: use mysql; 。 
  10.7、改密码:update user set password=password("123") where user="root";(别忘了最后加分号) 。 
  10.8、刷新权限(必须步骤):flush privileges; 。 
  10.9、 退出 quit。 
  10.10、注销系统,再进入,使用用户名root和刚才设置的新密码123登录。

 

11、修改root用户密码

5.7版本以前:

update user set authentication_string =password( 'root') where user = 'root;

5.7版本以后:

update user set password=password( 'root') where user = 'root;

 

posted @ 2016-08-17 13:55  宁_静悠远  阅读(430)  评论(0编辑  收藏  举报