MySQL数据库创建数据表前期工作

2025-10-26 05:12:36

1、步骤一:添加MYSQL的环境变量

右击我的电脑-属性-高级-环境变量-找到path,点击编辑,将C:或D:盘下的MYSQL的mysql/mysql server 5.6/bin的路径添加到path中

2、步骤二:登陆MYSQL

开始-运行-cmd-,在DOS环境下输入mysql  –h  localhost  –u  root  -p,输入密码,看到mysql>说明登陆成功。

C:\Documents and Settings\kwt>mysql -h localhost -u root -p

Enter password: ***

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 223

Server version: 5.5.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>    

3、步骤三:创建一个不存在的数据库(若已存在,此步骤省略)

本例:创建学生成绩数据库,数据库名为“wang”

mysql> CREATE DATABASE wang;

Query OK, 1 row affected (0.03 sec) 

mysql>  出现OK表示创建数据库成功

4、步骤四:指定当前操作的数据库(每次操作数据表时必须先做的步骤)

指定学生成绩数据库“xscj”为当前操作数据库

mysql> USE wang;

Database changed  当前数据库改变成功

mysql>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢