mysql 创建数据库,添加用户,用户授权

1.创建数据库语法
--创建名称为“testdb”数据库,并设定编码集为utf8
CREATE DATABASE zabbix; 

2.新建用户
--创建了一个名为:test 密码为:1234 的用户
create user 'zabbix'@'localhost' identified by '1234';
create user 'zabbix'@'%' identified by '1234';
#host – 指定该用户在哪个主机上可以登陆,如果是本地用户可用localhost,  如 果想让该用户可以从任意远程主机登陆, 
可以使用通配符%

3.查询用户
--查询用户
select user,host from mysql.user;

4.删除用户
--删除用户“test”
drop user test@localhost ;
--若创建的用户允许任何电脑登陆,删除用户如下
drop user test@'%';

5.更改密码
--方法1,密码实时更新;修改用户“test”的密码为“1122”
set password for test =password('1122');
--方法2,需要刷新;修改用户“test”的密码为“1234”
update  mysql.user set  password=password('1234')  where user='test'
--刷新
flush privileges;    

6.用户分配权限
GRANT 权限名字(多个权限用","号隔开) ON 数据库名.表名 TO '用户名'@'允许登录的ip地址' [IDENTIFIED BY '密 
码'];
例子:
GRANT ALTER,DELETE,INDEX,INSERT,SELECT,UPDATE ON zabbix_server.* TO 'zabbix'@'localhost' IDENTIFIED BY 
'123456789';
#给zabbix用户授权所有库所有权限
GRANT ALL ON *.* TO 'zabbix'@'%' IDENTIFIED BY '123456789';
--刷新
flush privileges;       

查看用户获得的授权:
SHOW GRANTS FOR 'USERNAME'@'HOST';
SHOW GRANTS FOR zabbix;

我来吐槽

*

*

已有 33 条评论

  1. clourgy

    cialis Frusemide Orders

  2. Twirway

    Cialis Non Funziona Che Fare stromectol for humans Cipla Pharmaceuticals

  3. uniobioli

    buy cialis online uk The two-level CES aggregate production function - that nests a CES into another CES function - has recently been used extensively in theoretical and empirical applications of macroeconomics

  4. fonaboibe

    priligy in usa Hims currently has 882 reviews on Trustpilot, and 80 of those reviews gave Hims at least four out of five stars

  5. uploact

    Is Cialis better than Viagra or Levitra can i buy cialis online In animal reproduction studies, no adverse developmental effects were observed with oral administration of tadalafil to pregnant rats or mice during organogenesis at exposures up to 11 times the maximum recommended human dose MRHD of 20 mg day see Data

  6. Imandabab

    In his 20 years of practice he has seen around five to six cases a year. ovulation calculator on clomid

  7. infamma

    The mean time from arrival to TT, aPTT, and PT INR results were 39 4. tamoxifen dosage

  8. Fiemorp

    945 Zero order or Higuchi model F7 0. doxycycline for uti dosage Severe cardiovascular adverse events, mostly lethal arrhythmias and heart failure, have been described in independent retrospective case series and case reports, and reported within the US Food and Drug Administration adverse events database.

  9. Iceplay

    lasix side effects on kidneys Astragalus is also called huang qi or milk vetch

  10. alardibly

    cialis without a prescription 2d 118 1989 noting that the patent laws embody a careful balance between the need to promote innovation and the recognition that imitation and refinement through imitation are both necessary to invention itself and the very lifeblood of a competitive economy; United States v

  11. Allercext

    Adverse effects of non hormonal pharmacological interventions in breast cancer survivors, suffering from hot flashes A systematic review and meta analysis buy stromectol europe

  12. Almobre

    pct clomid and nolvadex dosage PPAR RXR heterodimers preferentially bind to direct repeats spaced by 1 bp, while LXR RXR heterodimers preferentially bind to direct repeats spaced by 4 bp

  13. Epibigo

    priligy generika dapoxetine 60mg A The inner binding site

  14. Attaicift

    The patient might give a history of recurrent episodes of redness associated with viral keratitis clomiphene citrate 25 mg uses for male Dosage for Vagifem

  15. justymn

    Exemestane is often used to treat breast cancer that has returned or progressed to another region of the body buy doxycycline online uk

  16. Spoiffutt

    If you buy these from a manufacturer which offers steroids not a RCL, you ll be in contravention of the law lasix 80 mg

  17. legepunny

    is on the Scientific Advisory Boards of Labcorp, Inc buy stromectol 6 mg online

  18. hahacticy

    can lasix cause diarrhea The Y537S ESR1 mutant signature is prognostic of patient outcomes

  19. nuabnuame

    6 or in subgroups defined by duration, dose, or recency of use clomiphene 50mg As exciting strides are made in the field of breast cancer research and treatment our program continues to present essential up to the minute information combined with engrossing discussion for basic, translational and clinical cancer research professionals

  20. unfaina

    levitra que contiene Patients with no clinically palpable nodes are eligible only when thegreatest diameter of the tumor exceeds 1 cm

  21. frurgeorS

    stromectol 3 mg price Lloyd Evans, Emyr, Morgan, Anthony J

  22. ristsnums

    5 mg ml fatty acid extract from conjugated linoleic acid enriched egg yolks EFA CLA, or from control egg yolks EFA, or with 1 buy clomiphene citrate canada

  23. liapGearl

    Vitamin C also does more than just kill cancer cells, it boosts immunity cialis daily

  24. marlomi

    Barb even held donated injectables aside for me because she knew my husband and I couldn t afford them cheapest cialis available

  25. Snirlcync

    lasix for horses ActoPlus Met 500 mg of Norvase for frightened my bp scarcely dulled

  26. danianamn

    It may be true that they are healthier, but the causal relationship between the multivitamins and the better health is questionable and unlikely propecia results In vitro 2D and 3D cultures and in vivo cytotoxic properties of Zataria multiflora essential oil ZEO emulsion in breast and cervical cancer cells along with the investigation of immunomodulatory potential

  27. boufave

    Tumors tended to be slightly smaller in TransATAC than in NSABP B 14 stromectol 3mg dosage An Ran explained

  28. enlarly

    Orally transmembrane protease serine 2 TMPRSS2 inhibitor viagra before and after pics