MySQL基础教程1——使用mysql数据库

148 阅读1分钟

携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第30天,点击查看活动详情

MySQL基础教程1——使用mysql数据库

在安装好mysql环境后,使用win+r打开cmd命令栏,mysql在安装时我们会取个名字例如:mysql、mysql80等,可以通过右击我的电脑(此电脑)——管理——服务和应用程序——服务寻找mysql的名字。

启动

在cmd命令栏中输入net start mysql(本机mysql名字)

C:\Users\HP>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

关闭

在cmd命令栏中输入net stop mysql(本机mysql名字)

C:\Users\HP>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。

登入

在cmd命令栏中输入mysql -u root(账号) -p后会弹出输入密码的提示。

C:\Users\HP>mysql -u root -p
Enter password:(在此输入自己设置的密码即可登入)

成功登入后命令栏前缀为mysql>

例如:

C:\Users\HP>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (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>

(点击进入专栏查看详细教程)