MySQL_建库教本总结

mysql命令和Oracle 一样,大小写不敏感。
//连接MySQL
c:\> mysql -hlocalhost -uroot -proot3100
 
//查看数据库基本信息
mysql> use mysql;
mysql> show tables;//基本信息都保存在mysql库中的表中。,只有ROOT可以看
mysql> desc user;
 
//root可以切换到其他库
mysql>use test;
mysql>show tables;只能查看dbsvr库的库表.
 
//建立其他库(可以限制IP登陆)
mysql>create database dbsvr;
mysql>grant all privileges on dbsvr.* to hl3000@localhost         identified by 'hldw3101';
mysql>grant all privileges on   *.*   to sys@"%"                  identified by 'sys3100' ;//%表示允许此用户进行远程连接。
mysql>grant all privileges on   *.*   to wsh@"172.16.20.241"      identified by 'wsh'; ;//%表示允许此用户进行远程连接。
mysql>update user set host='172.16.19.249' where user='wsh';//可以修改数据字典
//root 查询user的host字段会体现%
mysql>show databases;

//建立库表
user dbsvr;//注意:在使用此命令以前一定要先使用use addbook命令,否则系统会提示没有可选的数据库。
create table AAA (id integer(2),name char(10)) ;//mysql中没有number类型,可用int代替
 
 
 //
 mysqladministrator?
 >mysqladmin?

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14884316/viewspace-536420/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/14884316/viewspace-536420/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值