1.下载解压版mysql
mysql-5.7.18-winx64.zip
2.自定义安装路径
自己安装路径
F:\myinstall\mysql\mysql-5.7.18-winx64
3.手动在bin目录下创建my.ini文件
F:\myinstall\mysql\mysql-5.7.18-winx64\bin
3.1 修改my.ini文件
修改内容:
basedir =“F:\myinstall\mysql\mysql-5.7.18-winx64”
datadir =“F:\myinstall\mysql\mysql-5.7.18-winx64”\data"
tmpdir =“F:\myinstall\mysql\mysql-5.7.18-winx64”\data"
socket =“F:\myinstall\mysql\mysql-5.7.18-winx64”\data\mysql.sock"
log-error=“F:\myinstall\mysql\mysql-5.7.18-winx64”
innodb_data_home_dir=“F:\myinstall\mysql\mysql-5.7.18-winx64”\data"
将以上需要修改的内容改为自己安装的mysql路径即可
client]
port=3306
default-character-set=utf8
[mysqld]
bind-address = 127.0.0.1
port=3306
character_set_server=utf8
basedir ="F:\myinstall\mysql\mysql-5.7.18-winx64"
datadir ="F:\myinstall\mysql\mysql-5.7.18-winx64"\data"
tmpdir ="F:\myinstall\mysql\mysql-5.7.18-winx64"\data"
socket ="F:\myinstall\mysql\mysql-5.7.18-winx64"\data\mysql.sock"
log-error="F:\myinstall\mysql\mysql-5.7.18-winx64"\data\mysql_error.log"
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
innodb_data_home_dir="F:\myinstall\mysql\mysql-5.7.18-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
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
3.2创建data数据存储文件
在F:\myinstall\mysql\mysql-5.7.18-winx64目录下新建data文件夹,必须为空
4.配置mysql环境变量
5.使用系统管理员方式cmd到mysql安装路径
1.在电脑左边找到命令提示符
2.执行如下命令
mysqld.exe -install
mysqld --initialize-insecure
mysqld -install
6.win10开启自动启动mysql服务
进入mysql安装页面的bin目录下,输入“mysqld.exe --install”
可以看到输出结果为:
mysqld.exe --install
Service successfully installed.
7.启动mysql服务net start mysql
net start mysql
7.1查看mysql是否启动成功
7.2查看mysql是否启动成功
安装成功还没设置密码回车即可
Mysql5.7.18修改密码
7.1 进入mysql执行如下修改密码
update user set password=password("123456") where user="root";
update mysql.user set authentication_string=password('123456') where user='root';
mysql> select user from user;
+-----------+
| user |
+-----------+
| mysql.sys |
| root |
+-----------+
2 rows in set (0.00 sec)
mysql> update user set password=password("123456") where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'# 修改报错
mysql> update mysql.user set authentication_string=password('123456') where user='root'; # 再执行修改成功
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges; # 刷新权限
Query OK, 0 rows affected (0.00 sec)
mysql> quit;# 退mysql
Bye
C:\Users\jkl>
7.2 重新进入mysql
发现不输入密码,直接报错,输入密码后直接进入mysql了
C:\Users\jkl>mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
C:\Users\jkl>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
相关文章
暂无评论...