老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

mysql數據庫基本授權的具體操作流程

下文我給大家簡單講講關于MySQL數據庫基本授權的具體操作流程,大家之前了解過相關類似主題內容嗎?感興趣的話就一起來看看這篇文章吧,相信看完mysql數據庫基本授權的具體操作流程對大家多少有點幫助吧。

公司主營業務:網站設計、網站制作、移動網站開發等業務。幫助企業客戶真正實現互聯網宣傳,提高企業的競爭能力。創新互聯是一支青春激揚、勤奮敬業、活力青春激揚、勤奮敬業、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業文化,感謝他們對我們的高要求,感謝他們從不同領域給我們帶來的挑戰,讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創新互聯推出黃陂免費做網站回饋大家。

查看mysql數據庫的版本
登錄數據庫查看:
1.用戶密碼登錄時
mysql -uroot -p123456
2.mysql> status;  
3.mysql> select version();  
未登錄數據庫時查看:
1.mysql --help | grep Distrib    
2.rpm -qa|grep mysql

mysql基本操作和授權:(介紹5.7的和5.6很多地方不一樣哦)
MySQL Server version: 5.7.23
本文的數據庫test
本文的表名test
本文的用戶名test
show databases; 命令查看已經創建了哪些數據庫。
show columns from test 或者desc test;獲取表結構命令:
shou tables 查看所有的表
use database1; 切換數據庫
show grants;  查看當前用戶的權限
show grants for test@"%";  查看其它用戶的權限,test@"%"代表user表中的user和host字段
flush privileges; 刷新系統權限
mysql中沒有像oracle set line 100 pages 9999的設置,可以在最后加入\G
例如:select * from user\G;

mysql -h 主機名 -u 用戶名 -p
-p:密碼登錄, 如果登錄的用戶名密碼為空, 可以忽略此選項。
-D:所選擇的數據庫名

重置mysql的數據庫密碼
1、首先停掉mysql 數據庫 一般是安裝在/etc/init.d/mysqld stop
2、修改mysql的配置文件 /etc/my.cnf  
最后一行添加 skip-grant-tables 表示可以跳過權限去登錄
3、重啟 mysql 數據庫 /etc/init.d/mysqld start
3、使用 mysql -u root -p
4、修改root密碼。
update user set password=PASSWORD("123456") where user='root';
5、修改配置文件刪除或禁用skip-grant-tables這行。
注:mysql的數據庫老版本用參數authentication_string,新版本用參數password
update user set authentication_string=password('123456') where user='root';
update user set password=password('123456') where user='root';
flush privileges; --刷新系統權限表

創建數據庫
create database test character set gbk;
測試建表
create table test(id int,name varchar(20),bianma varchar(20));
INSERT INTO test VALUES (1,'tom1','13211');
INSERT INTO test VALUES (2,'tom2','13212');
INSERT INTO test VALUES (3,'tom3','13213');
INSERT INTO test VALUES (4,'tom4','13214');

刪除數據庫
drop database test_database;
刪除表
drop table test_tab;

創建用戶命令:
GRANT USAGE ON . TO 'test'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
或者
create user 'test1'@'%' identified by '123456';
兩條命令都可以,用戶名test密碼是123456

刪除用戶命令:
mysql> drop user 'test1'@'%'
mysql> drop user 'test'@'localhost'
注意刪除格式:'user'@'host'

mysql數據庫授權:
grant 權限 on 數據庫對象 to 用戶
權限:增刪改查, insert,delete,update,select,create,alter,drop,all等
references 外鍵權限,create temporary 創建臨時表權限,index 創建索引權限,create view和show view 創建視圖和查看視圖權限,create routine和alter routine 創建和修改存儲過程權限,execute 操作函數權限,
數據庫對象:表名,數據庫名.表名,test.,.*等
用戶:要取得權限的用戶,test,test@localhost,test@"%",格式的意思是user表中的user和host

授權用戶test只查看表test中的兩個字段的權限
grant select(name,id) on test to test@'%' ;

授權test用戶擁有test數據庫的所有權限:
grant all privileges on test. to test@localhost identified by '123456'; --privileges可省略不寫
grant all on test. to test@localhost;
授權部分權限給用戶
grant select,update on test. to test@localhost identified by '123456';
grant select,update on test. to test@localhost ;

授權test用戶擁有所有數據庫的某些權限:  
grant select,delete,update,create,drop on . to test@"%" identified by "123456";
或者
grant all on test.* to test@localhost;

test用戶可以將test數據庫中的所有表的select權限授權給其它用戶
grant select on test. to test with grant option;
注:以上例句將替換成表名,將test數據庫中的某個表作為數據庫對象

取消授權,撤銷授權,授權收回
revoke all on . from test;
授權和取消授權的語句基本一致,將grant和revoke互換,from和to互換就可以。
取消授權
revoke select on . from test;
授權
grant select on . to test;

mysql能夠像Oracle的sqlplus那樣設置pagesize和linesize
select * from table_name\G;

mysql delete中where后能套用select
delete test_user from test_user a, (select id from test_user where id < 10) b
where a.id = b.id

表數據太大只查看5行
select from gp_plat_user where rownum < 6;
select from gp_plat_user limit 6;

錯誤集錦:
報錯1.Ignoring query to other database
mysql> show databases;
Ignoring query to other database
mysql> show user;
Ignoring query to other database
方案:
登錄的使用參數 -u
報錯2.
ERROR 1130 (HY000): Host '10.1.1.10' is not allowed to connect to this MySQL server
[root@master logs]# mysql -uroot -p123456 -h 10.1.1.10
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1130 (HY000): Host '10.1.1.10' is not allowed to connect to this MySQL server
方案:跳過密碼登錄,修改數據庫中的host字段

mysql> select host,user from user where user='root';
+-----------+------+
| host      | user |
+-----------+------+
| localhost | root |
+-----------+------+
1 row in set (0.00 sec)
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> commit;      --這個命令也可以提交哦
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user where user='root';
+------+------+
| host | user |
+------+------+
| %    | root |
+------+------+
1 row in set (0.00 sec)

報錯3.
登錄時報錯:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
方案:mysql -uroot -p123456
報錯4.登錄后查詢數據庫報錯:
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
提示說讓操作之前先要用命令ALTER USER修改密碼
我使用下面的alter命令修改后,不好使,就用set修改的,修改完后可以使用。
方案: alter user 'root'@'localhost' identified by '123456';  --不好使
set password=password("123456"); --好使

錯誤5.
mysql> insert into user(Host,User,authentication_string) values("localhost","test",password("123456"));
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
方案: set global validate_password_policy=0;
set global validate_password_length=1;
查看的方法:select @@validate_password_policy;
select @@validate_password_length;
詳情可以看這個技術博主https://www.cnblogs.com/ivictor/p/5142809.html

錯誤6.
mysql> insert into user(Host,User,authentication_string) values("localhost","test",password("123456"));
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
報錯ssl_cipher字段不能為空,mysql添加用戶不能直接insert user表中。
方案:網上說修改配置文件my.cnf中由
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES改為:sql_mode=NO_ENGINE_SUBSTITUTION
對于5.7版本的mysql不好使,使用如下的命令進行創建新用戶好使
GRANT USAGE ON . TO 'test'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
mysql> GRANT USAGE ON . TO 'test'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> select user,host from user;
+---------------+-----------+
| user          | host      |
+---------------+-----------+
| root          | %         |
| mysql.session | localhost |
| mysql.sys     | localhost |
| test          | localhost |
+---------------+-----------+
4 rows in set (0.00 sec)
錯誤7:
[root@master logs]# mysql -utest -ptest
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: YES)
方案:和錯誤2一樣
修改host:update user set host = '%' where user = 'test';

navicat的快捷鍵:
Ctrl+Q、Ctrl+N            打開查詢窗口
Ctrl+/            注釋sql語句
Ctrl+Shift +/  解除注釋
Ctrl+R           運行查詢窗口的sql語句
F6               打開一個mysql命令行窗口
Ctrl+L           刪除一行
Ctrl+W          關閉一個查詢窗口
Ctrl+D         表的數據顯示顯示頁面切換到表的結構設計頁面,但是在查詢頁面寫sql時是復制當前行

和權限有關的幾張表

大家覺得mysql數據庫基本授權的具體操作流程這篇文章怎么樣,是否有所收獲。如果想要了解更多相關,可以繼續關注我們的行業資訊板塊。


文章名稱:mysql數據庫基本授權的具體操作流程
URL標題:http://www.xueling.net.cn/article/pcesco.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 亚洲理论片在线观看 | 日本少妇三级HD激情在线观看 | 亚洲精品一区3d动漫在线 | 久久激情欧美 | japanese16hdxxxx无码 | av人摸人人人澡人人超碰小说 | 日本肉体裸交XXXXBBBB | 欧美高潮又爽又黄又硬又无遮 | 无码一区免费在线不卡 | 国产精品va无码免费麻豆 | 欧美日韩特级黄片观看 | 靠比视频免费观看 | 亚洲精品韩国 | 96人成网站色www免费 | 亚洲国产综合在线观看 | 久久国产日韩 | 中文字幕免费在线观看动作大片 | 一区二三区日韩精品 | 国产激情av| 情侣偷拍久久 | 羞羞色国产精品网站 | 佐山爱国产在线一区 | 爱草视频在线 | 97狠狠| 仙武帝尊700集在线观看 | 久久精品国产77777蜜臀 | 免费午夜无码视频在线观看 | 中文字幕网伦射乱中文 | 亚洲在线观看网站 | 欧美一级特黄aaaaaaa色戒 | 亚洲成成品网站 | 一级毛片国产 | 少妇人妻200篇白洁 久久99精品国产99久久6男男 | 张雨绮被揉到高潮下不了床 | 亚洲国产AV无码专区亚洲AV | 91免费污视频 | 牛牛热在线视频 | 亚洲精品天堂成人片AV在线播放 | 青青青在线视频观看 | 福利精品 | 国产高清视频在线观看播放 |