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/

你可能感兴趣的:(数据库)