mysql默认端口3306
服务器登录
mysql -uroot -p
输入密码登录
[mysql@yyq mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.Commands end with ;
or \g.
Your MySQL connection id is 73
Server version: 8.0.28-commercial MySQL Enterprise Server - CommercialCopyright (c) 2000, 2022, Oracle and/or its affiliates.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|
+--------------------+
| mysql|
| sys|
+--------------------+
2 rows in set (0.01 sec)mysql>
切换数据库
use mysql
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql>
查看所有表
show tables;
mysql> show tables;
+--------------------+
| Tables_in_ibase|
+--------------------+
| a_group|
| a_info|
| a_log|
| a_report|
+--------------------+
4 rows in set (0.00 sec)mysql>
sql文件导入 无需指定数据库,初始化导入
123456是密码,init_schema.sql是导入的文件,./指当前目录下
mysql -uroot -p123456 < ./init_schema.sql
指定数据库导入
123456是密码,yyqdb是导入的数据库,yyqdb.sql为导入的文件
mysql -uroot -p123456 yyqdb < ./yyqdb.sql
数据库下导入
source ./yyqdb.sql
需要先登录数据库,然后source
[mysql@yyq mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.Commands end with ;
or \g.
Your MySQL connection id is 73
Server version: 8.0.28-commercial MySQL Enterprise Server - CommercialCopyright (c) 2000, 2022, Oracle and/or its affiliates.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> use yyqdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> source ./yyqdb.sqlQuery OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)mysql>
退出 【MySQL|【MySQL】mysql常用命令】quit与exit均可
mysql> quit
Bye
[mysql@yyq mysql]#
mysql> exit
Bye
[mysql@yyq mysql]#
推荐阅读
- Java毕业设计项目实战篇|基于javaweb+springboot的美食菜谱分享平台系统设计和实现(java+springboot+mysql+ssm)
- 5G投资稳步下降(三大运营商CAPEX支出集体“转向”)
- MYSQL|mysql5.7安装和配置教程(图文超详细版)
- 容器化 | 在 K8s 上部署 RadonDB MySQL Operator 和集群
- 如何选择印度服务器机房()
- java|看《韩顺平Java》视频的笔记
- java|java 登录注册小程序
- mysql|【centos7 + MySQL5.7 安装】centos7 安装MySQL5.7
- Linux笔记|Linux Nginx