真的是安软件的坑王,不管安什么软件都有一大堆报错,给自己一个总结。
- 在创建的MySQL文件夹下创建 my.ini 配置文件,编辑 my.ini 配置信息。(不知道如何创建ini文件)
- 初始化数据库出现问题(mysql --initialize --console)
- 安装时报错(mysqld install)
- 登录数据库时,密码问题
1.在创建的MySQL文件夹下创建 my.ini 配置文件,编辑 my.ini 配置信息。
创建记事本,将后缀名txt改为ini。
ini文件内容如下
[client]
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=C:\\web\\mysql-8.0.11
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\web\\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
2.初始化数据库出现问题(mysql --initialize --console)
[ERROR] --initialize specified but the data directory has files in it. Aborting.
出现如上所示错误。我是因为之前有初始化,所以安装目录下存在data文件夹,看了网上很多做法,说白了就是直接把data文件夹删除,你就可以重新初始化了。
3安装时报错(mysqld install)
install/Remove of the Service Denied
要用管理员身份运行!!!(找到cmd.exe 右键,以管理员身份运行)
4登录数据库时,密码问题
D:\MyDownloads\mysql-8.0.18-winx64\bin>mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
这里其实是有默认密码的,在你初始化数据库时,会有一条【note】
2018-04-20T02:35:05.464644Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: APWCY5ws&hjQ
类似于这样,localhost后面的就是密码,你可以先记录一下。
我是因为粘贴复制之后上面没有显示,其实粘贴之后只需要在点击一下就会显示了!(真的太菜了)
D:\MyDownloads\mysql-8.0.18-winx64\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.18
Copyright (c) 2000, 2019, 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> exit
Bye
这是最后成功的页面。