【mysql常用命令】教程文章相关的互联网学习教程文章

mysql常用命令【代码】

use myblog;-- show tables-- 插入语句-- insert into users(username,`password`,realname) values(‘遥远‘,‘123‘,‘ooo‘);-- 查询users所有列-- select *from users;-- 查询id username 列 -- select id, username from users;-- 查询 user表 username=zhangsan -- select *from users where username=‘zhangsan‘;-- select *from users where username=‘zhangsan‘ and password=‘123‘;-- 模糊查询-- select *from use...

MySQL常用命令【代码】

1、登录数据库mysql -h localhost -uroot –p2、导出数据库mysqldump -uroot -p db > db.sql3、导入数据库mysql -uroot -p db < db.sql4、开启远程登录,局域网访问grant all privileges on *.* to ‘root‘@‘%‘ indentified by ‘你的密码‘ with grant option;flush privileges;5、创建用户CREATE USER ‘test‘@‘localhost‘ IDENTIFIED BY ‘password‘; grant all privileges on *.* to test@‘localhost‘ identified by ...

MYSQL常用命令总结

1:使用SHOW语句找出在服务器上当前存在什么数据库:mysql> SHOW DATABASES;2:2、创建一个数据库MYSQLDATAmysql> CREATE DATABASE MYSQLDATA;3:选择你所创建的数据库mysql> USE MYSQLDATA; (按回车键出现Database changed 时说明操作成功!)4:查看现在的数据库中存在什么表mysql> SHOW TABLES;5:创建一个数据库表mysql> CREATE TABLE MYTABLE (name VARCHAR(20), sex CHAR(1));6:显示表的结构:mysql> DESCRIBE MYTABLE;7:往表中加入...

mysql常用命令

mysql安装:yum list mysql-serveryum install mysql-server启动mysql服务:service mysqld start尝试连接mysql然后\q关闭连接设置mysql开机启动:chkconfig mysqld onchkconfig --listMysql管理:设置密码:mysqluse mysql;update user set password=password(‘密码‘) where user=‘root‘;flush privileges;设置mysql远程访问:grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘密码‘ with grant option;mysql...

mysql 常用命令【代码】

1、连接Mysql格式: mysql -h主机地址 -u用户名 -p用户密码1、连接到本机上的MYSQL。 首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root -p,回车后提示你输密码.注意用户名前可以有空格也可以没有空格,但是密码前必须没有空格,否则让你重新输入密码。如果刚安装好MYSQL,超级用户root是没有密码的,故直接回车即可进入到MYSQL中了,MYSQL的提示符是: mysql>2、连接到远程主机上的MYSQL。假设远程主机的IP为:...

MySQL数据库维护中监控所用到的常用命令(转载)

status = show status like ‘%%‘ [例:show status like ‘Com_select‘]variables = show variables like ‘%%‘ [例:show variables like ‘query_cache_size‘]1、MySQL查询次数(取自show status返回信息)Com_select;Com_update;Com_insert;Com_delete;Com_change_db2、查询缓存空间大小:query_cache_size查询缓存最大查询数据集大小:query_cache_limit(variables);(取自show variables返回信息)缓存中的查询个数:Qcache_inse...

MySQL 数据库和一些常用命令的使用

常用命令总结:12345678910111213141516171819202122232425262728293031323334353637create database name; 创建数据库use databasename; 选择数据库drop database name; 直接删除数据库,不提醒show tables; 显示表describe tablename; 表的详细描述select 中加上distinct去除重复字段 显示当前mysql版本和当前日期select version(),current_date; 修改mysql中root的密码:shell>mysql -u root -pmysql> update user set password...

MySQL常用命令

SHOW DATABASES返回可用数据库的一个列表,包含在这个列表中的可能是MySQL内部使用的数据库(如MySQL和information_schema)SHOW TABLES返回数据库内的表的列表SHOW COLUMNS FROM CUSTOMERS,DESCRIBE Customer返回表列SHOW CREATE TABLE Test1show table status like‘test1%‘ create table Customer(id int not null Primary key AUTO_INCREMENT,name varchar(50),Age int)ALTER TABLE Customer ENGINE=‘Myisam‘ 改变表的Eng...

MySQL 数据库常用命令 简单超级实用版

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=...

Mysql 常用命令【代码】

1.mysql 导出数据库脚本:mysqldump -h10.10.10.10 -uusername -ppassword -d dataBase > /tmp/dataBase.sql2.mysql 导入数据库脚本:mysql -h10.10.10.10 -uusername -ppassword -DdataBase</tmp/xxx.sql3.mysql 查询出表结构和字段信息:SELECT a1.表注释, a2.表名, a2.列名, a2.数据类型, a2.字段类型, a2.长度, a2.是否为空, a2.默认值, a2.备注 FROM ( SELECT TABLE_NAME AS 表名, TABLE_COMMENT AS 表注释 FROM INFORMATION...

Linux下mysql数据库常用命令一

生产真实服务器下环境操作:192.168.24.37192.168.24.37(Server)081119Last login: Tue Aug 11 15:08:10 2015 from 192.168.24.1#远程连接数据库[root@jxatei ~]# mysql -u root -h 117.40.239.9 -p #远程连接数据库Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 948Server version: 5.5.41-cll-lve MySQL Community Server (GPL) by AtomicorpCopyright (c) 2000, 2...

MySQL常用命令记录【代码】【图】

第一章 1.登录数据库系统mysql –u root -p 2.查看已存在的数据库SHOW DATABASES; 3.查看默认存储引擎SHOW VARIABLES LIKE ‘storage_engine‘; 4.创建数据库CREATE DATABASE school; 5.删除数据库DROP DATABASE school; 6.查看该数据库系统支持的存储引擎的类型,代码如下:SHOW ENGINES; 第二章 1.创建一个example的数据库;CREATE DATABASE school;USE example;2.创建student表和grade表 创建student表的代码 CREATE...

mysql dos常用命令

net start mysql 连接数据库mysql -u 用户名 -p 密码登陆 create database 库名; //创建数据库create table `student`( id int(20) primary key not null, name varchar(255), tid int(20)); //创表 create table `teacher`( tid int(20), tname varchar(255)); alter table teacher add constaraint teacher_pk primary key teacher(tid); //添加主键 alter table student add constaraint student_fk_te...

mysql常用命令

引擎MyISAM强调的是性能,比InnoDB快,但不提供事务支持,复杂的任务,关联。支持表锁。类似excel表格。安装时默认模式。InnoDB,支持外部键,可以执行大量的insert和update,像银行系统 两个引擎,类似apache两个工作模式Database库>tables表>row行MyISAM 类型的表强调的是性能,主要用于select(查询)操作,执行速度比InnoDB类型的表快,但不提供事务支持。支持表锁InnoDB类的表提供事务支持,适合复杂的逻辑关系,执行大量的ins...

linux下mysql常用命令

转自:http://www.jb51.net/LINUXjishu/36171.html一、总结一下: 1.linux下启动mysql的命令: mysqladmin start /ect/init.d/mysql start (前面为mysql的安装路径) 2.linux下重启mysql的命令: mysqladmin restart /ect/init.d/mysql restart (前面为mysql的安装路径) 3.linux下关闭mysql的命令: mysqladmin shutdown /ect/init.d/mysql shutdown (前面为mysql的安装路径) 4.连接本机上的mysql: 进入目录mysql\bin,再键入命令m...