
| mysqladmin -uroot -password ab12 |
| mysqladmin -uroot -pab12 password djg345 |
| grant select,insert,update, delete on *.* to test1@"%" Identified by "abc"; |
| grant select,insert,update, delete on mydb.* to test2@localhost identified by "abc"; |
| grant select,insert,update,delete on mydb .* to test2@localhost identified by ""; |
| show databases; |
| use mysql; //打开库,学过FOXBASE的一定不会陌生吧 show tables; |
| describe 表名; |
| create database 库名; |
| use 库名; create table 表名 (字段设定列表); |
| drop database 库名; drop table 表名; |
| delete from 表名; |
| select * from 表名; |
| drop database if exists school; //如果存在SCHOOL则删除 create database school; //建立库SCHOOL use school; //打开库SCHOOL create table teacher //建立表TEACHER ( id int(3) auto_increment not null primary key, name char(10) not null, address varchar(50) default ’深圳’, year date ); //建表结束 //以下为插入字段 insert into teacher values(’’,’glchengang’,’深圳一中’,’1976-10-10’); insert into teacher values(’’,’jack’,’深圳一中’,’1975-12-23’); |
| mysql -uroot -p密码 < c:\\school.sql |
| mysqldump --opt school>school.bbb (命令在DOS的\\mysql\\bin目录下执行) |
| mysql> user mysql; mysql> update user set pasword=password('21century') where user='root'; mysql> flush privileges; |
| [root@test1 local]# mysql ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) |
| [root@test1 local]# mysql -u root -p Enter password: (输入修改后的密码21century) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 177 to server version: 3.23.48 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> |
| mysqldump -uroot -p21century meeting > db_meeting.sql |
| mysqldump -uroot -p21century dbname < xxx.sql |
| RENAME TABLE ztemp TO ztemp4; |
| ALTER TABLE bbabase CHANGE news_id id VARCHAR(5) NOT NULL; |
| 欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) | Powered by Discuz! 6.0.0 |