mysql 自解压版配置

因为最近换了电脑,正好趁这个机会记录下,myql安装的相关配置。

环境版本说明
  • mysql-8.0.15-winx64
  • windows10 x64
1、增加环境变量配置

增加mysql环境变量配置:
新增MYSQL_HOME
PATH后追加:%MYSQL_HOME%\bin

2、新增my.ini文件

在mysql解压根目录增加文件my.ini,添加以下内容(里面对应的【安装目录】,【存放目录】需要根据自己实际路径进行修改)。
版本8以上,目录自带data文件夹,不需要再重新新建。

[mysql]
; 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
;设置3306端口
port = 3306 
; 设置mysql的安装目录
basedir=D:\00_develop\mysql-8.0.13
; 设置mysql数据库的数据的存放目录
datadir=D:\00_develop\mysql-8.0.13\data
; 允许最大连接数
max_connections=200
; 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
; 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

3、执行相关命令:

1、mysqld --initialize --console,此时会显示出mysql初始密码,需要记录以便后面修改密码使用
    2019-07-14T13:43:11.639614Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: +rPeTQgqg04r
2、net start mysql
      这一步如果没有install如果报错 无效的服务名,
      执行:mysqld --install 成功之后继续按照这个步骤执行
3、mysql -u root -p
4、然后输入上面第一步返回的初始密码
5、ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysql';(修改root用户的密码为mysql)


直接上运行命令

PS C:\Users\Administrator> d:
PS D:\> cd D:\00_develop\mysql-8.0.13\bin
PS D:\00_develop\mysql-8.0.13\bin> mysqld --initialize --console
2019-07-14T13:43:06.813217Z 0 [System] [MY-013169] [Server] D:\00_develop\mysql-8.0.13\bin\mysqld.exe (mysqld 8.0.13) initializing of server in progress as process 7256
2019-07-14T13:43:06.834479Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2019-07-14T13:43:11.639614Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: +rPeTQgqg04r
2019-07-14T13:43:13.793727Z 0 [System] [MY-013170] [Server] D:\00_develop\mysql-8.0.13\bin\mysqld.exe (mysqld 8.0.13) initializing of server has completed
PS D:\00_develop\mysql-8.0.13\bin> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

PS D:\00_develop\mysql-8.0.13\bin> mysql -u root p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
PS D:\00_develop\mysql-8.0.13\bin> mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.13

Copyright (c) 2000, 2018, 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> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysql';
Query OK, 0 rows affected (0.02 sec)

mysql>
微信图片_20190718140215.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 我曾经在公司处理过很多次Mysql性能上的问题,利用一些Linux常用的命令来查看Mysql对服务器的CUP和I/...
    小怪聊职场阅读 14,982评论 2 91
  • feisky云计算、虚拟化与Linux技术笔记posts - 1014, comments - 298, trac...
    不排版阅读 9,322评论 0 5
  • 什么是数据库? 数据库是存储数据的集合的单独的应用程序。每个数据库具有一个或多个不同的API,用于创建,访问,管理...
    chen_000阅读 9,451评论 0 19
  • 技术文档——Mysql-Cluster-7.5集群搭建 前言 随着时代的发展,新技术的层出不穷。Mysql数据库在...
    云spark阅读 9,353评论 1 7
  • 作者:张张 今天要和大家讲一讲橙子小姐的爱情。橙子小姐的爱情和大多数人一样来的不早不晚。橙子小姐的另一半是羊排先生...
    YI只猫阅读 4,245评论 0 0