標籤:res 修改 current span int creat 改密碼 type register
mysql命令
一、初試命令:
show databases; # 查看當前Mysql都有那些資料,根目錄都有那些檔案夾
create database 資料庫名; # 建立檔案夾
use 資料庫名; # 使用選中資料庫,進入目錄
show tables; # 查看當前資料庫下都有那些表,
create table 表名(nid int,name varchar(20), pwd varchar(64)); # 建立資料庫表
select * from 表名; # 查看錶中的所有資料
insert into 表名(nid,name,pwd) values(1,‘alex‘,‘123‘); # 插入資料
select * from 表名;
樣本:
1 [[email protected] ~]# mysql -uroot -p #再輸入密碼 2 Welcome to the MySQL monitor. Commands end with ; or \g. 3 Your MySQL connection id is 4 4 Server version: 5.5.49 MySQL Community Server (GPL) 5 6 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 7 8 Oracle is a registered trademark of Oracle Corporation and/or its 9 affiliates. Other names may be trademarks of their respective10 owners.11 12 Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.13 14 15 #建立資料庫16 mysql> create database test1;17 Query OK, 1 row affected (0.02 sec)18 19 20 #進入test1庫中21 mysql> use test1;22 Database changed23 24 #建立表tb1(nid和name欄位)25 mysql> create table tb1(nid int,name varchar(20));26 Query OK, 0 rows affected (0.06 sec)27 28 #建立tb2 (nid和name欄位)29 mysql> create table tb2(nid int,name varchar(20));30 Query OK, 0 rows affected (0.01 sec)31 32 #查看錶33 mysql> show tables;34 +-----------------+35 | Tables_in_test1 |36 +-----------------+37 | tb1 |38 | tb2 |39 +-----------------+40 2 rows in set (0.01 sec)41 42 #查看所有表43 mysql> select * from tb1;44 Empty set (0.01 sec)45 46 #往表中插入資料47 mysql> insert into tb1(nid,name)values(1,‘alex‘);48 Query OK, 1 row affected (0.01 sec)49 50 #往表中插入資料51 mysql> insert into tb1(nid,name)values(1,‘eric‘);52 Query OK, 1 row affected (0.01 sec)53 54 #查看所有表55 mysql> select * from tb1;56 +------+------+57 | nid | name |58 +------+------+59 | 1 | alex |60 | 1 | eric |61 +------+------+62 2 rows in set (0.00 sec)63 64 #退出65 mysql> exit66 Bye
二、使用者授權
使用者管理特殊命令:
建立使用者
create user ‘使用者名稱‘@‘IP地址‘ identified by ‘密碼‘;
刪除使用者
drop user ‘使用者名稱‘@‘IP地址‘;
修改使用者
rename user ‘使用者名稱‘@‘IP地址‘; to ‘新使用者名稱‘@‘IP地址‘;;
修改密碼
set password for ‘使用者名稱‘@‘IP地址‘ = Password(‘新密碼‘)
MySQL(一)