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

怎么登陆和退出MySQL

1.使用管理员身份进入命令提示符(cmd),进入%MySQL_HOME%\bin 目录下,

MySQL_HOME为自己的安装路径。

2. 启动mysql数据库 。DOS命令窗口中输入 net start mysql, 
Shell> net start mysql
3.登陆数据库。 
方式一:
shell> mysql -h host -u user -p
Enter password: ********
host并 user表示运行MySQL服务器的主机名和MySQL帐户的用户名。替换适合您的设置的值。该 ********代表你的密码; 
mysql显示Enter password:提示时输入它
例子如:
shell>mysql -h localhost -u root -p
Enter password: *********
localhost:表示本地;-u为数据库用户名,root是mysql默认用户名;-p为密码,
       1)如果设置了密码,可直接在-p后链接输入,如:-p666;
2)用户没有设置密码,显示Enter password时,直接回车即可。
例如:mysql -hlocalhost -uroot -p666回车直接登陆

方式二:

 如果你在运行MySQL的同一台计算机上登录,则可以省略主机,只需使用以下命令:

shell> mysql -u user -p
如:
E:\MySQL\mysql-5.7.21-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: 5.7.21 MySQL Community Server (GPL)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>

4.可以输入show databases;查看下数据库;
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| boot_crm           |
| crm                |
| music              |
| mysql              |
| performance_schema |
| springmvc          |
+--------------------+
7 rows in set (0.00 sec)
5.成功连接后,QUIT(或\q)【不区分大小写】来随时断开连接mysql>
mysql> quit
6.关闭数据库命令为net stop mysql


http://www.taodudu.cc/news/show-6310700.html

相关文章:

  • 【physx/wasm】在physx中添加自定义接口并重新编译wasm
  • excel---常用操作
  • Lora训练Windows[笔记]
  • linux基础指令讲解(ls、pwd、cd、touch、mkdir)
  • InnoDB 事务处理机制
  • 启明云端ESP32 C3 模组WT32C3通过 MQTT 连接 AWS
  • 退出mysql控制台与退出mysql
  • 在cmd 中输入了错误mysql命令后,如何退出?
  • 谓词逻辑的推理
  • 命题逻辑(详解)
  • 英语学习——逻辑之道
  • 英文写作中常用的逻辑词汇
  • 逻辑英语笔记
  • 逻辑英语结构【重点】
  • 思考外语学习的底层逻辑(以英语、法语为例)
  • Ubuntu 经验 :软件安装 :安装.AppImage文件
  • ubuntu appimage文件打不开的解决方案
  • Ubuntu中运行AppImage文件的方法
  • AppImage应用启动报错:Cannot mount AppImage, please check your FUSE setup
  • 解决linux下.AppImage文件无法运行问题
  • Ubuntu: AppImage格式安装、卸载
  • Ubuntu 22.04 解决使用 .AppImage 文件方法
  • Linux下使用AppImageLauncher安装AppImage文件
  • appimage转deb
  • IOS-UIImageView
  • Ubuntu22.04点击.appimage软件不运行
  • 怎么样在Linux上使用AppImage?
  • 如何在 Ubuntu 上使用 AppImage 软件镜像包?
  • 什么是AppImage?
  • 利用appimage工具对开发好的项目进行打包
  • ~/Telerik.Web.UI.WebResource.axd' is missing in web.config
  • [MRCTF2020]PYWebsite -wp
  • Easy Web
  • Buuctf-WEB-Havefun(WP)
  • webfirst
  • web application与web site