MySql 命令
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Mysql
show databases;
create database name;
use databasename;
drop database name
show tables;
describe tablename;
select distinct
mysqladmin drop databasename
mysql
select version(),current_date;
mysql root
shell>mysql -h localhost -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);
grant
firstdb(firstdb)firstdb
mysql> create database firstdb;
mysql> grant all on firstdb.* to firstdb identified by 'firstdb'
firstdb
mysql localhost,IP127.0.0.1IP
IP grant
mysql>grant all on *.* to root@202.116.39.2 identified by "123456";
:grant on :insert,select,update
on ,**
root@IP identified by
drop database firstdb;
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@"%" IDENTIFIED BY 'something' WITH GRANT OPTION;
mysql> revoke all privileges on *.* from root@"%";
mysql> delete from user where user="root" and host="%";
mysql> flush privileges;
custom fangchandb
mysql >grant select, insert, update, delete, create,drop on fangchandb.* to custom@ identified by ' passwd'
:
mysqldump
shell> mysqldump -h host -u root -p dbname >dbname_backup.sql
shell> mysqladmin -h myhost -u root -p create dbname
shell> mysqldump -h host -u root -p dbname < dbname_backup.sql
shell> mysqladmin -u root -p -d databasename > a.sql
sql
shell> mysqladmin -u root -p -t databasename > a.sql
sql?
mysqldump -T./ phptest driver
-T./mysqldump driver.sql. txt sql
mysql
my_file.sql
sql.txt
mysql > mysql -h myhost -u root -p
Mysql5.0
MySQL¬(ORACLE)
sysuser
Create TABLE `firstdb`.`users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(40) default NULL,
`birthday` date default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gb2312;
MySQL latin1;
MySQL ä(my.ini) ;
mysqld ;
character_set_server ;
ûcharacter_set_server;
character_set_database ;
ûcharacter_set_database
;
;
mysqldump ;Query Browser1.1
notebook copy
update ers set username='' where id=3;
MYSQL
1.
mysqldump -u §-p --default-character-set=latin1 Q>
(latin1)
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
2.
mysqldump -u §-p ¿>
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
3.
mysqldump -u wcnc -p -d -add-drop-table smgp_apps_wcnc >d:wcnc_db.sql
-d -add-drop-table create drop table
4.
A:source
mysql
mysql -u root -p
mysql>use
source(.sql)
mysql>source wcnc_db.sql
B:mysqldump
mysqldump -u username -p dbname < filename.sql
C:mysql
mysql -u username -p -D dbname < filename.sql
1MySQL MySQL Command Line Client(MySQL DOS)
mysql>
2MySQL quit exit
1
create database <>
xhkdb
mysql> create database xhkdb;
2
show databases (s)
mysql> show databases;
3
drop database <>
xhkdb
mysql> drop database xhkdb;
4
ºuse <>
xhkdb
mysql> use xhkdb;
Database changed
5
mysql> select database();
6
mysql> show tables; (s)
1
create table <> ( <1> <1> [,..
> id int(4) not null primary key auto_increment,
> name char(20) not null,
> sex int(4) not null default '0',
> degree double(16,2));
2
ºdesc show columns from
mysql>DESCRIBE MyClass
mysql> desc MyClass;
mysql> show columns from MyClass;
3