MySQL_Server_8.0.17_环境搭建_NaviCat 12.1.12 连接_基础知识(1)

  1. MySQL 下载、安装、配置:
    1.1 下载地址:https://dev.mysql.com/downloads/mysql/
    download_the_mysql_server8.0.171.2 解压、配置文件:解压至C盘’web’文件夹,
    在mysql-8.0.17文件夹下新增配置文件"my.ini":
[client]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=C:\\web\\mysql-8.0.17
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\web\\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

1.3数据库初始化、安装、启动

#切换目录
cd C:\web\mysql-8.0.17\bin
#数据库初始化,初始化完成后会输出用户名及密码
mysqld --initialize --console
# 数据库安装
mysqld install
#数据库启动
net start mysql




#待解决问题:若根用户密码忘记,再次初始化能否覆盖之前的用户名与密码
#再次初始化,报错信息
C:\web\mysql-8.0.17\bin>mysql --initialize --console
mysql: [ERROR] unknown option '--initialize'.

C:\web\mysql-8.0.17\bin>mysqld --initialize --console
2019-08-06T12:38:51.917931Z 0 [System] [MY-013169] [Server] C:\web\mysql-8.0.17\bin\mysqld.exe (mysqld 8.0.17) initializing of server in progress as process 16740
2019-08-06T12:38:51.923761Z 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-08-06T12:38:51.925938Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-08-06T12:38:51.925976Z 0 [ERROR] [MY-013236] [Server] The designated data directory C:\web\mysql-8.0.17\data\ is unusable. You can remove all files that the server added to it.
2019-08-06T12:38:51.939936Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-06T12:38:51.940969Z 0 [System] [MY-010910] [Server] C:\web\mysql-8.0.17\bin\mysqld.exe: Shutdown complete (mysqld 8.0.17)  MySQL Community Server - GPL.

1.4 登陆数据库:

#按如下格式输入命令行
mysql -h 主机名 -u 用户名 -p  # mysql -u root -p  连接本机数据库
#根据提示输入密码即可登陆

# e.g.
C:\web\mysql-8.0.17\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.17 MySQL Community Server - GPL

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>



#根用户密码重置&#x
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值