mysql建库需要权限吗_mysql 建库报匿名用户权限错误
ERROR 1044 (42000): Access denied for user [email?protected] to database ‘meitu‘
系統(tǒng)環(huán)境:
Centos 7.5
Mysql Server version: 5.6.48
分析原因:匿名用戶(‘‘)權(quán)限報(bào)錯(cuò)
問題描述:
安裝好mysql后,root用戶賬戶登錄mysql,創(chuàng)建一個(gè)新數(shù)據(jù)庫時(shí),提示報(bào)錯(cuò),如下:
[[email?protected] mysql]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.48 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
mysql> create database meitu charset=utf8;
ERROR 1044 (42000): Access denied for user [email?protected] to database ‘meitu‘
解決方法:
1. 在/etc/my.cnf的[mysqld]字段下加入:skip-grant-tables , 如下截圖
2. 再重啟mysqld服務(wù)
[[email?protected] ~]$ systemctl restart mysqld
這時(shí)的mysql不需要密碼即可登錄數(shù)據(jù)庫
3. 登錄進(jìn)入mysql,執(zhí)行以下命令
mysql > use mysql;
mysql > delete from user where USER=‘‘;
mysql > flush privileges;
mysql > exit;
4. 再刪除/etc/my.ini中的skip-grant-tables,重啟mysqld服務(wù)即可正常建庫了。
原文:https://blog.51cto.com/10316297/2496822
總結(jié)
以上是生活随笔為你收集整理的mysql建库需要权限吗_mysql 建库报匿名用户权限错误的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 青蛙换位java_青蛙换位
- 下一篇: c语言中用于获取字符串长度的函数是,C语