SQl学习:phpstudy工具使用命令行访问数据库
在使用phpStudy V8版本学习数据库过程中,发现新版的系统页面内无直接打开MySQL命令行的选项(也有可能是我找不到…),小萌新很懵逼,故此记录打开MySQL命令行操作步骤
phpStudy:https://www.xp.cn/download.html
操作步骤
- 使用cmd命令行进入phpStudy 安装路径:D:phpstudy_proExtensionsMySQL5.7.26in
- 输入:mysql -u root -p
- 输入密码即可
操作步骤 D:>cd phpstudy_pro/Extensions/MySQL5.7.26/bin D:phpstudy_proExtensionsMySQL5.7.26in>mysql -u root -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 1138 Server version: 5.7.26 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>
命令记录
- 查看所有数据库 show databases; """ mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | +--------------------+ 5 rows in set (0.00 sec) """
- 创建数据库 create database test1;
- 使用数据库 use test; """ mysql> use test; Database changed """
- 查询所有数据表 show tables; """ mysql> show tables; +----------------+ | Tables_in_test | +----------------+ | test_table | +----------------+ 1 row in set (0.00 sec) """
- 删除数据库 drop database test1;
- 查看表结构 desc test_table; """ mysql> desc test_table; +-------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+-------+ | ID | int(11) | YES | | NULL | | | Name | varchar(255) | YES | | NULL | | +-------+--------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) """
- 删除数据表 drop table test_table;
