Query OK, 1 row affected (0.00 sec)
mysql>use bank
Database changed
mysql>create table chuhu(chuhu_id int,chuhu_name varchar(20))
Query OK, 0 rows affected (0.05 sec)
mysql>insert into chuhu values(1,'张三')
Query OK, 1 row affected, 1 warning (0.02 sec)
mysql>insert into chuhu values(2,'李四')
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql>commit
Query OK, 0 rows affected (0.00 sec)
mysql>insert into mysql.user(Host,User,Password) values("localhost","bank_admin",password("000000"))
Query OK, 1 row affected, 3 warnings (0.01 sec)
mysql>commit
Query OK, 0 rows affected (0.00 sec)
mysql>flush privileges
Query OK, 0 rows affected (0.05 sec)
mysql>grant select,update on bank.chuhu to bank_admin@localhost identified by '000000'
Query OK, 0 rows affected (0.00 sec)
mysql>flush privileges
Query OK, 0 rows affected (0.00 sec)
D:\mysql5.0\bin>mysql -ubank_admin -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with or \g.
Your MySQL connection id is 2
Server version: 5.0.51b-community-nt MySQL Community Edition (GPL)
Type 'help' or '\h' for help. Type '\c' to clear the buffer.
mysql>use bank
Database changed
yhk存储用的是字符串类型也就是varchar类型;备注:因为yhk的号码较长,并且全是数字,为了方便存储,就统一存储为字符串类型。如果存储为number类型,已经超出了int类型最大值范围,必须用bigInteger存储,很不方便。并且位数太多的数值会变成科学计数法,不利于数据的正常转换,所以还是用字符串类型存储更方便一些。
*** 作方法如下:
*** 作设备:戴尔笔记本电脑
*** 作系统:win10
*** 作程序:mysqlv8.2
2、输入cmd,打开命令行,如下图所示:
3、输入Net start Mysql,启动mysql服务,如下图所示:
4、先输入create database,如下图所示:
5、然后输入你想要的数据库名字,如下图所示:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)