当前位置: 首页 > news >正文

Windows X64环境下mysql5.6.51安装指南

1)下载

mysql5.6.51介质下载地址:https://downloads.mysql.com/archives/community/

2)下载后解压到D:或E:

3)创建环境变量

4)配置参数

my.ini参数如下

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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.

[mysqld]

character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

# 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 = E:\mysql-5.6.51-winx64
datadir = E:\mysql-5.6.51-winx64\data

port = 3306
# server_id = .....


# 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 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
 

my-default.ini参数如下:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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.

[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 = .....
# datadir = .....
# port = .....
# server_id = .....


# 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 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

[mysqld]
character-set-server=utf8mb4
[mysql]
default-character-set=utf8mb4

以管理员身份运行cmd(不然权限不够),通过命令进入mysql bin 目录运行命令|:

mysqld --initialize-insecure --user=mysql

再次执行如下命令

mysql -hlocalhost -uroot -p

netstat -ano|findstr 3306

mysqld -install

到此 说明mysql 已经安装成功。

注意如发现mysql服务安装路径不对可通过指令sc delete MySQL进行删除后再安装;

启动mysql服务:命令如下
E:\mysql-5.6.51-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

5)用户登录及实际操作

mysql -u root -p第一次登录无密码。


查看数据库:show databases;
创建数据库:create database dbai;
进入数据库:use dbai;
使用查看当前数据库的表:show tables;
user表如果没有创建:create table user(username varchar(8),password varchar(8)); 
向表里添加数据:insert into user(username,password) values('admin','1234');
                         insert into user(username,password) values('user1','1111');
然后查看user表:select * from user;

创建新表格

create table bearnumsex(id varchar(6),DateTime datetime,swimgap FLOAT(5,2),innersize1 int(6),innersize2 int(6),unit varchar(50),date varchar(10),type varchar(10),repair varchar(10),imgpath varchar(50));

alter table bearnumsex convert to character set utf8mb4 collate utf8mb4_bin;  更新表格使其支持中文

6)问题处理

问题1:程序运行访问数据库提升如下:数据库打开失败 Access denied for user 'root'@localhost (using password:YES) QMYSQL:Unable to connect

处理方法:请参考:在MySQL登录时出现Access denied for user ‘root‘@‘localhost‘ (using password YES) 拒绝访问问题解决_mysql显示access denied for user-CSDN博客

问题2:

QSqlDatabase: QMYSQL driver not loaded

QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

处理方法:将mysql数据路径lib下的lib和dll放到Qt程序的可执行程序下。

http://www.lryc.cn/news/586081.html

相关文章:

  • SpringBootloggers未授权访问漏洞处理
  • 基于MCP的CI/CD流水线:自动化部署到云平台的实践
  • Unity VR手术模拟系统架构分析与数据流设计
  • JVM 中“对象存活判定方法”全面解析
  • 同步、异步、阻塞、非阻塞之间联系与区别
  • Windows符号链接解决vscode和pycharm占用C盘空间太大的问题
  • [论文阅读] 人工智能 + 软件工程 | AI助力软件可解释性:从用户评论到自动生成需求与解释
  • 利用scale实现分页按钮,鼠标经过按钮放大
  • 12.使用VGG网络进行Fashion-Mnist分类
  • 解决bash终端的路径名称乱码问题
  • java单例设计模式
  • pip国内镜像源一览
  • 高校/企业/医院食堂供应链平台开发详解:采购系统源码的核心价值
  • MySQL 中图标字符存储问题探究:使用外挂法,毕业论文——仙盟创梦IDE
  • Oxygen XML Editor 26.0编辑器
  • 车载诊断架构 --- 诊断功能开发流程
  • Operation Blackout 2025: Smoke Mirrors
  • 日志不再孤立!用 Jaeger + TraceId 实现链路级定位
  • 传感器WSNs TheDataLinkLayer——X-MAC
  • 前端开发中的输出问题
  • try-catch-finally可能输出的答案?
  • [BUUCTF 2018]Online Tool
  • MCP上的数据安全策略:IAM权限管理与数据加密实战
  • Vim的magic模式
  • QT跨平台应用程序开发框架(5)—— 常用按钮控件
  • RS232通信如何实现(硬件部分)
  • 请求服务端获取broker的机房归属信息异常
  • 端到端自动驾驶:挑战与前沿
  • Unity URP + XR 自定义 Skybox 在真机变黑问题全解析与解决方案(支持 Pico、Quest 等一体机)
  • 时序数据预处理