当前位置:网站首页>MySql安装+测试连接+常用终端mysql命令(超详细)
MySql安装+测试连接+常用终端mysql命令(超详细)
2022-06-10 02:00:00 【宝宝很可爱】
MySQL,本质上就是一个软件。
主要有两种版本:8.x和5.x ,一般使用 5.7.31版本。
1.下载压缩包
可以直接访问下面网址进行下载
https://downloads.mysql.com/archives/community/
或者进入官网一个一个点击,下面是详细点击顺序:
进入MySql官网——downloads——MySQL Community (GPL) Downloads——MySQL Community Server——Archives——选择版本,下载64位zip




2、安装
mysql-5.7.31-winx64.zip 是免安装的版本。
- 解压zip文件
- 将解压后的文件夹放入路径(不要有中文路径)

3、创建配置文件(my.ini)
4、初始化
- 打开终端cmd
- 以管理员的权限去运行

- 输入初始化的命令
"C:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --initialize-insecure

MySql安装已经完成。
5、制作成Windows服务,服务来进行关闭和开启
- 5.1.制作服务
"C:\Program Files\mysql-5.7.31-winx64\bin\mysqld.exe" --install mysql57
mysql 5 7 :起个名字,因为是5.7.31版本,所以叫mysql57
启动mysql: net start mysql57
关闭mysql: net stop mysql57
5.2.我的名字叫做:mysql2 (因为安装第二个版本的mysql)
要在管理员权限下打开cmd
5.3 也可以在window的服务管理中点击按钮启动和关闭服务。
任务管理器——服务——打开服务——mysql57(右击开启或关闭mysql)
任务管理器快捷键:ctrl + shift + Esc

6、连接测试
安装目录有空格,所以要加上引号
"C:\Program Files\mysql-5.7.31-winx64\bin\mysql.exe" -h 127.0.0.1 -P 3306 -u root -p
- 本地主机ip: 127.0.0.1
- 端口:-P 3306
- 用户名:-u
上面的命令可以简化为下面的命令:(默认都是自己的主机,端口3306,所以可以省略主机ip+端口)
"C:\Program Files\mysql-5.7.31-winx64\bin\mysql.exe" -u root -p
当然还可以再精简些:
如果你将路径 C:\Program Files\mysql-5.7.31-winx64\bin\ 添加到了系统环境变量。
如何添加mysql…bin路径至系统环境变量,请看
https://blog.csdn.net/qq_45432276/article/details/125151652?spm=1001.2014.3001.5502
则可以输入下面进行 最精简版本的测试(登录mysql):
mysql -u root -p

登录成功。
说明:mysql自带工具(mysql.exe)连接mysql成功了。
7、设置密码
登录成功后 可以设置密码:
set password = password('root123');

8、查看已有的文件夹(数据库)
show databases;

9、退出(关闭连接)
exit;

10、mysql命令汇总
汇总命令:
mysql -u root -p //登录mysql
set password = password('root123'); //设置密码
show databases; //查看数据库
exit; //退出
mysql -u root -p //登录mysql
root //输入密码
exit; //退出
边栏推荐
- Trichview and scalericview set default Chinese
- [email protected]和[email protected]装载5-Fu(5-氟尿
- “无法访问 您可能没有权限使用网络资源”解决办法
- [FPGA] Day17 introduction to single bus protocol DS18B20
- 【FPGA】day16-FIFO实现uart协议
- Industrial practice example of industrial defect detection based on openvino deployment
- kubelet启动一个Pod CRI、CNI、CSI 起作用的顺序
- When the MySQL service is started during initialization, it shows that net is neither an internal or external command nor a runnable program. How to solve this problem? This is the same as net Exe mis
- 副业收入是我做程序员的3倍,工作外的B面人生是怎样的?
- Operation of simulated examination platform of recurrent training question bank for operation of refrigeration and air conditioning equipment in 2022
猜你喜欢

Inftnews | when the meta universe is going on: how are those big Internet companies planning their layout?

Simulated 100 questions and answers of the third batch of Guangdong Provincial Safety Officer a certificate (principal) examination in 2022

基于OpenVINO部署的工业缺陷检测产业实践范例实战

剑指 Offer 10- II. 青蛙跳台阶问题

When the MySQL service is started during initialization, it shows that net is neither an internal or external command nor a runnable program. How to solve this problem? This is the same as net Exe mis

The idea version of postman comes out, which is easy to test and use

35岁职场焦虑,越来越多的人这样选择

Smart Cloud Light Gateway Service pour améliorer l'efficacité de la gestion de la production

LeetCode 530: 二叉搜索树的最小绝对差

机智云轻网关服务,提升生产管理效率
随机推荐
重塑 IT 领导职业生涯的六种方法
Unity netcode for GameObject 1.0.0 learning notes (I) - Hello World demo
A small problem in installing composer
【LeetCode】114. Expand binary tree into linked list
[neural network] (22) convmixer code reproduction, network analysis, complete tensorflow code attached
WebRTC 的音频弱网对抗之 NACK
Smart Cloud Light Gateway Service pour améliorer l'efficacité de la gestion de la production
MySQL script for Linux Installation
[email protected]和[email protected]装载5-Fu(5-氟尿
SQL语句编写
Why does chip design also need "Craftsmanship"?
Environment configuration and initial compilation of source code analysis of virtual engine ue4.26
Leetcode 700: search in binary search tree
【LeetCode】287. Find duplicates
[untitled]
MySQL multi table query
Use primecache to speed up your computer!
Internet of things engineering design and Implementation
Webmaster Tools browser SEO plug-in - Webmaster Essential Tools SEO website ranking quick view website data
Linux安装MySQL脚本