MySQL数据库使用——MySQL数据库管理
来源:互联网 发布:宝钢武钢合并。知乎 编辑:程序博客网 时间:2024/06/14 12:02
- 登录系统用户
- 创建数据库CREATE DATABASE
- 显示数据库SHOW DATABASE
- 删除数据库DROP DATABASE
- 使用与跳转数据库USE DATABASE
开发时一般不使用系统的root用户,应该是创建一个新的用户,管理一个工程。
登录用户的命令:mysql -uusername -p
登录完成后就进入SQL命令格式,格式以“;”结尾。
登录系统用户
windows用安装的时候设置的root登录命令行,如下图所示。
Linux安装时若没有提示设置root密码的,可以使用系统默认的账号和密码。
账号密码在文件/etc/mysql/debian.cnf中
ghost@ghost-machine:~$ sudo cat /etc/mysql/debian.cnf[sudo] ghost 的密码: # Automatically generated for Debian scripts. DO NOT TOUCH![client]host = localhostuser = debian-sys-maintpassword = j0oQ******ZmVsocket = /var/run/mysqld/mysqld.sock[mysql_upgrade]host = localhostuser = debian-sys-maintpassword = j0oQ******ZmVsocket = /var/run/mysqld/mysqld.sockghost@ghost-machine:~$
ghost@ghost-machine:~$ mysql -udebian-sys-maint -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 10Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
创建数据库:CREATE DATABASE
创建的数据库为基本数据库,根据各个项目名来创建这个项目下用到的数据库类型。数据库的管理只能是本地登录的管理员用户进行管理,不能通过远程进行管理。
SQL命令:
create database zx_mysql;
mysql> create database zx_mysql;Query OK, 1 row affected (0.02 sec)mysql>
显示数据库:SHOW DATABASE
SQL命令:
show databases;
mysql> show databases;+---------------------------+| Database |+---------------------------+| information_schema || mysql || performance_schema || sys || zx_mysql |+---------------------------+6 rows in set (0.00 sec)mysql>
删除数据库:DROP DATABASE
SQL命令:
drop database zx_mysql;
mysql> drop database zx_mysql;Query OK, 0 rows affected (0.19 sec)mysql>
使用与跳转数据库:USE DATABASE
SQL命令:
use database zx_mysql;
mysql> use zx_mysql;Database changedmysql>
阅读全文
0 0
- MySQL数据库使用——MySQL数据库管理
- MySQL数据库使用——MySQL用户管理
- MySQL数据库使用——MySQL表管理
- MySQL数据库使用——MySQL字段管理
- 使用phpMyAdmin管理MySQL数据库
- MySQL数据库—使用命令行操作数据库
- 【MySql】MySql之数据库管理
- ubuntu使用phpAdmin网页管理Mysql数据库
- python下使用alembic管理MYSQL数据库
- mysql数据库管理
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL数据库管理常用命令
- MySQL主主复制+keepalived打造高可用MySQL集群
- STL学习笔记
- ORACLE RAC体系结构图
- AutoCAD .Net 设置UCS与直线对齐
- 编写简单通用makefile
- MySQL数据库使用——MySQL数据库管理
- bzoj4519[Cqoi2016]不同的最小割
- bootstrap selectpicker 动态增加选项
- Java并发编程的艺术(十)——线程池(1)
- Linux 进程--父进程查询子进程的退出状态
- 考题篇(5.4) NSE4 05. 防火墙验证 ❀ 飞塔 (Fortinet) 网络安全专家
- 知道答案在哪里比知道答案更重要
- 处理输入成绩异常
- Adobe Dreamweaver CC 2018 Mac破解版(dw mac破解版) v2018.0破解版