日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql数据库用户的创建_mysql创建用户及数据库

發(fā)布時(shí)間:2024/7/5 数据库 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql数据库用户的创建_mysql创建用户及数据库 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

登陸mysql

[root@dn210120 conf]# mysql -uroot

創(chuàng)建用戶及密碼

mysql> grant usage on *.* to 'hive14'@'localhost' identified by '123456' with grant option;

創(chuàng)建數(shù)據(jù)庫

mysql> create database hive14 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

賦予新用戶操作新數(shù)據(jù)庫的權(quán)限

##本地訪問

mysql> grant all privileges on hive14.* to hive14 identified by '123456';

##遠(yuǎn)程訪問

mysql> grant all privileges on hive14.* to hive14@'%' identified by '123456';

##刷新全局權(quán)限

mysql> flush privileges; 碰到問題:

不能直接使用insert語句進(jìn)行新增用戶

mysql> insert into mysql.user(Host,User,Password) values("localhost","hive14",password("1234"));

ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value

創(chuàng)建用戶時(shí)只能指向本機(jī),否則本機(jī)登陸不了mysql

grant usage on *.* to 'hive14'@'%' identified by '123456' with grant option;

其它知識:

修改autocommit屬性值

[root@dn210120 ~]# vi /etc/my.cnf

##增加autocommit=0,不自動提交

autocommit=0

[root@dn210120 ~]# service mysql restart

另外一種創(chuàng)建方式:

[root@dn210120 dbgen]# mysql

Welcome to the MySQL monitor. ?Commands end with ; or \g.

Your MySQL connection id is 1103

Server version: 5.6.19-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create user 'tpch'@'%' identified by 'tpch';

Query OK, 0 rows affected (0.00 sec)

mysql> create user 'tpch'@'%' identified by 'tpch';

Query OK, 0 rows affected (0.00 sec)

mysql> create database tpch;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on tpch.* to 'tpch'@'%';

Query OK, 0 rows affected (0.00 sec)

mysql> use tpch;

Database changed

mysql> show tables;

Empty set (0.00 sec)

總結(jié)

以上是生活随笔為你收集整理的mysql数据库用户的创建_mysql创建用户及数据库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。