Home > Database > Mysql Tutorial > MySQL数据库常用命令 超级实用版分享_MySQL

MySQL数据库常用命令 超级实用版分享_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:54:40
Original
817 people have browsed it

1、MySQL常用命令

create database name; 创建数据库

use databasename; 选择数据库

drop database name 直接删除数据库,不提醒

show tables; 显示表

describe tablename; 表的详细描述

select 中加上distinct去除重复字段

mysqladmin drop databasename 删除数据库前,有提示。

显示当前mysql版本和当前日期

select version(),current_date;

2、修改mysql中root的密码:

shell>mysql -u root -p

mysql> update user set password=password(”xueok654123″) where user=’root’;

mysql> flush privileges //刷新数据库

mysql>use dbname; 打开数据库:

mysql>show databases; 显示所有数据库

mysql>show tables; 显示数据库mysql中所有的表:先use mysql;然后

mysql>describe user; 显示表mysql数据库中user表的列信息);

3、grant

创建一个可以从任何地方连接服务器的一个完全的超级用户,但是必须使用一个口令something做这个

mysql> grant all privileges on *.* to user@localhost identified by ’something’ with

增加新用户

格式:grant select on 数据库.* to 用户名@登录主机 identified by “密码”

GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY ’something’ WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON *.* TO monty@”%” IDENTIFIED BY ’something’ WITH GRANT OPTION;

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template