mysql 常用语句
2009-10-13 15:27
375 查看
1.添加用户
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
2.远程连接
use mysql;
update user set host='%' where user='root';
3.
mysql -u root mysql
mysql> UPDATE user SET Password = PASSWORD('newpwd')
-> WHERE User = 'root';
mysql> FLUSH PRIVILEGES; //需要此句生效
4.
建立索引:
mysql>alter table 表名 add index (字段);
mysql>alter table 表名 add primary key (字段);
mysql> show columns from 表名;
刪除索引:
mysql>alter table 表名 drop index 字段;
mysql>alter table 表名 drop primary key 字段;
mysql>show columns from 表名;
5.备份
mysql\bin>mysqldump -u root -proot orapp > back.sql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
2.远程连接
use mysql;
update user set host='%' where user='root';
3.
mysql -u root mysql
mysql> UPDATE user SET Password = PASSWORD('newpwd')
-> WHERE User = 'root';
mysql> FLUSH PRIVILEGES; //需要此句生效
4.
建立索引:
mysql>alter table 表名 add index (字段);
mysql>alter table 表名 add primary key (字段);
mysql> show columns from 表名;
刪除索引:
mysql>alter table 表名 drop index 字段;
mysql>alter table 表名 drop primary key 字段;
mysql>show columns from 表名;
5.备份
mysql\bin>mysqldump -u root -proot orapp > back.sql
相关文章推荐
- MySQL常用语句
- MySQL几种常用的建表语句(一)
- MySQL常用shell语句
- mysql常用查询语句笔记
- Mysql 常用 SQL 语句集锦
- 23个MySQL常用查询语句
- PHP中常用的mysql语句
- 常用mysql语句
- [MySQL学习]常用SQL语句大全总结
- mysql常用语句
- mysql常用SQL语句
- MySql常用语句
- MySql常用30种SQL查询语句优化方法
- Mysql 备份还原和一些常用操作语句
- mysql常用命令行操作语句
- mysql常用语句
- MySQL常用语句大全
- mysql常用查询语句
- 关于mysql 简单的查询语句 以及常用函数的 总结
- 关于mysql 简单的查询语句 以及常用函数的 总结