国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

MySQL創建數據庫相關命令

2024-07-24 12:36:27
字體:
來源:轉載
供稿:網友

轉載請注明來源-作者@loongshawn:http://blog.csdn.net/loongshawn/article/details/73634525,建議讀者閱讀原文,確保獲得完整的信息

1.數據庫創建

第一步:登錄數據庫,輸入命令sudo mysql -u root -p

[loongshawn@e100069197189.zmf /home/loongshawn]$sudo mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)[loongshawn@e100069197189.zmf /home/loongshawn]$sudo mysql -u root -p Enter password: Welcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 41892Server version: 5.6.21 MySQL Community Server (GPL)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.This software comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to modify and redistribute it under the GPL v2 licenseType 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> 

第二步:登錄數據庫,查看當前已存在數據庫,并創建創建數據庫。

mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || data_loong_1       || data_loong_2       || mapdata_1          || mapdata_2          || mysql              || performance_schema || rong_1             || rong_2             || test               |+--------------------+10 rows in set (0.02 sec)

創建數據庫命令create database knowledge_base_daily;

mysql> create database knowledge_base_daily;Query OK, 1 row affected (0.00 sec)

2.分配權限

給數據庫分配用戶、分配權限,由于庫中已存在用戶,就不再新建用戶及權限了,然后manager這個用戶擁有數據庫的所有權限;

mysql> grant all privileges on knowledge_base_daily.* to 'manager'@'%' identified by '12345678';Query OK, 0 rows affected (0.08 sec)mysql> grant all privileges on knowledge_base_publish.* to 'manager'@'%' identified by '12345678';Query OK, 0 rows affected (0.00 sec)mysql> 

如果需要給具體用戶分配數據庫具體數據表的權限,使用以下命令,如manager擁有table的update權限。

grant update on knowledge_base_publish.table to 'manager'@'%';

補充說明如何新建用戶,通過命令:

create user 'loongshawn'@'%' identified by '12345678';Query OK, 0 rows affected (0.08 sec)

3.補充說明

若文中有不詳盡之處,請留言或自行去百度搜索。歡迎討論。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 玛曲县| 香格里拉县| 福安市| 铜陵市| 胶州市| 成都市| 宝兴县| 龙南县| 龙井市| 临西县| 镇江市| 沐川县| 福州市| 竹溪县| 阳山县| 会泽县| 廉江市| 常州市| 斗六市| 左贡县| 山丹县| 揭东县| 天气| 增城市| 湘潭市| 宁河县| 剑阁县| 涞水县| 江永县| 古浪县| 扎赉特旗| 遵义市| 双峰县| 年辖:市辖区| 措勤县| 岑巩县| 阿巴嘎旗| 洛南县| 连云港市| 北海市| 绥阳县|