可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

I am facing problem creating the database and it results in following error. mysql>show grantsfor'admin'@'%';+---------------------------------------------------------------------------------------------------------------------------------+|Grantsforadmin@%|+---------------------------------------------------------------------------------------------------------------------------------+|GRANT ALL PRIVILEGES ON*.*TO'admin'@'%'IDENTIFIED BY PASSWORD'*4ACFE3202A5FF5CF467898FC58AAB1D615029441'WITH GRANT OPTION|+---------------------------------------------------------------------------------------------------------------------------------+1rowinset(0.00sec)mysql>create database abc;ERROR1006(HY000):Can't create database 'abc' (errno: 13)

Here is my users table. mysql>selecthost,userfrommysql.user;+-------------+-------+|host|user|+-------------+-------+|%|admin||127.0.0.1|root||::1|root||IVM-MMC-DGW|root||localhost|admin||localhost|root|+-------------+-------+6rowsinset(0.00sec)mysql>show grants;+-----------------------------------------------------------------------------------------------------------------------------------------+|Grantsforadmin@localhost|+-----------------------------------------------------------------------------------------------------------------------------------------+|GRANT ALL PRIVILEGES ON*.*TO'admin'@'localhost'IDENTIFIED BY PASSWORD'*4ACFE3202A5FF5CF467898FC58AAB1D615029441'WITH GRANT OPTION|+-----------------------------------------------------------------------------------------------------------------------------------------+1rowinset(0.00sec)

I can create and remove table in the existing database.

The data directory already has mysql:mysql privileges and also the logged in user has privilege to create the new database.

What configuration is missing here ?

回答1:

There may be a permissions issue with the MySQL data directory. You could try setting the permissions as follows (adjust the path to your data directory) chown-R mysql:mysql/usr/local/mysql/data

回答2:

This happens probably due to permission denied by MySQL. Though you set the datadir=/drbd0/mysql/data, but by default MySql set socket = /var/lib/mysql/mysql.sock, so you should have the privileges to that directory. less/etc/group

and then less/etc/passwd

find mysql user and group name, by default, it's mysql user in mysql group.

change to mysql dir, probably /var/lib/mysql and then type cd .. to go up one directory. chown-R mysql:mysql./mysql/

Replace mysql:mysql with something different if you group and user privileges are called differenty

回答3:

It might be problem with space. Follow this Check .err logs at /var/lib/mysql

if the log says something like "[ERROR] Can't start server: can't create PID file: No space left on device"

Check /var size by df -hk /var

if used is 100% , then u have to find the files which is geting filled.

find large file in /var by find /var/ -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

see which file you can delete and then restart the mysql process by

/etc/init.d/mysql restart

let me know if that worked :)

回答4:

sudo chown -R mysql:mysql /var/lib/mysql/

回答5:

For Mac OS use this command sudo chown-R mysql:mysql/usr/local/mysql*

User mysql should have write access to mysql data directory.

回答6:

In /etc/mysql/my.cnf, set datadir = /home/mysql_data, which is the location where the database files actually are on yourmachine

回答7:

if you move the mysql folder you restart mysql, it works

回答8:

Same issue, in my case I changed the default directory on my.cf and the selinux has blocking it.

To test: setenforce0

To fix (CentOS)

Add context and make it permanent semanage fcontext-a-s system_u-tmysqld_db_t"/var/data/mysql(/.*)?"restorecon-Rv/var/data/mysql

回答9:

Turn off SELinux especially if you're on CentOS.

回答10:

Check your mysql data directory permissions. The data directory is configured in '/etc/my.conf' by default. Or use mysqladmin -uroot -p variables | grep datadir to find the directory. It may be /var/lib/mysql/ by default, and makesure the owner user and group is mysql. chown -R mysql:mysql /usr/local/mysql/data

If it has not been solved by step 1. It may be because of SELinux in your way, try to turn off it. Test if SELinux is running. selinuxenabled && echo enabled || echo disabled

Turning off SELinux temporarily. echo 0 > /selinux/enforce

Completely turning off SELinux. Change config SELINUX=disabled, and reboot.

In different os, the configuration directory of SELinux may be different.

回答11:

Running WAMP and i had same issue, opted for the traditional stop and start all services and that did it for me. I was able to create the database after that, really don't know why i wasn't able to create it at first as i had no issue with space or permission. Well i hope this helps the WAMP users

can't select mysql database_ERROR 1006 (HY000) Can't create database (errno: 13) MySQL 5.6.12相关推荐

  1. MySQL: 1006 - Can't create database '***' (errno: 13) 错误 解决方法

    原文连接:https://blog.csdn.net/kexiaoling/article/details/50259569 如果使用root账号登录到数据库create database时提错错误: ...

  2. mysql hy000 1005,mysql – ERROR 1005(HY000):无法创建表(errno:150)

    当我尝试在 mysql中创建一个表时,我收到一个错误. 任何提示解决吗? create table stock_in( ind int not null auto_increment, itemcod ...

  3. MySQL数据库的基本操作-创建(create database)、选择(use)、查看(shows database)、删除(drop database)

    一.MySQL概述 MySQL是目前最流行的开源数据库,是完全网络化的跨平台关系型数据库系统,尤其与PHP,被称为黄金组合. MySQL的特点: 1.功能强大. 2.支持跨平台. 3.运行速度快. 4 ...

  4. mysql: however file don't exists. Create writable for user 'mysql'.

    第一次启动mysql5.7时,报错. [root@test2 my57_3307]# /usr/local/mysql57/bin/mysqld_safe --defaults-file=/dbdat ...

  5. mysql 新建database_MySQL创建数据库(CREATE DATABASE语句)

    在 MySQL 中,可以使用 CREATE DATABASE 语句创建数据库,语法格式如下: CREATE DATABASE [IF NOT EXISTS] [[DEFAULT] CHARACTER ...

  6. 【MySQL】MySQL RROR 3680 (HY000): Failed to create schema directory ‘db2019‘ (errno: 2 - No such file

    1. 概述 新装机的MySQL,然后想建立一个数据库,报错如下 [lcc@lcc /usr/local/mysql]$ mysql -uroot -p12345678 mysql: [Warning] ...

  7. mysql 5.5.修改库名_安全快速修改Mysql数据库名的5种方法

    1. RENAME DATABASE db_name TO new_db_name 这个..这个语法在mysql 5.1.7中被添加进来,到了5.1.23又去掉了. 据说有可能丢失数据.还是不要用的好 ...

  8. l源码安装mysql升级_[Linux]javaEE篇:源码安装mysql

    javaEE :源码安装mysql 安装环境 系统平台:CentOS-7-x86_64 数据库版本:mysql-5.6.14 源码安装mysql步骤: 一.卸载mysql 安装mysql之前,先确保l ...

  9. 4、MySQL创建数据库(CREATE DATABASE语句)

    在 MySQL 中,可以使用 CREATE DATABASE 语句创建数据库,语法格式如下: CREATE DATABASE [IF NOT EXISTS] <数据库名> [[DEFAUL ...

最新文章

  1. 将 Silverlight 与网页集成【转载】
  2. 网站被K的解决方案有哪些?
  3. 【五线谱】拍号与音符时值 ( 五线谱拍号 | 全音符休止符 | 二分音符休止符 | 四分音符休止符 | 八分音符休止符 | 十六分音符休止符 | 三十二分音符休止符 )
  4. 4米乘以12米CAD图_CAD做钣金件展开的原理你知道吗?
  5. asp.net程序的问题原来是IE造成的,改用firefox就没问题了!
  6. Linux下安装memcache以及扩展
  7. OpenCV-黑帽运算(BLACKHAT)
  8. _CentOS「linux」学习笔记11:crontab定时任务常用参数和基本语法
  9. ASP.NET MVC3书店--第二节 控制器(转)
  10. 社团管理系统软件测试,软件测试大作业-社团管理系统.doc
  11. 机器学习(周志华)学习笔记(二)
  12. 【一名合格前端工程师的自检清单】--自检答案
  13. 一种简单的生成伪随机数的方法(翻译)
  14. 学习Java时,要记住的知识点太多,记不住怎么办?
  15. 保研面试/考研复试中文自我介绍模板(30秒、1分钟、2分钟、3分钟)
  16. 跳一跳改分java源码_解密微信小程序漏洞:可下载任意小游戏源代码,“跳一跳”可改分...
  17. Nginx启动成功但页面访问不到的解决方法
  18. Hadoop详解以及历史版本介绍
  19. html嵌入bilibili视频
  20. 风影导航网站源码v1.0 带后台

热门文章

  1. 等宽分箱_数据分析师-数据挖掘如何分箱以及对箱子中的数据进行平滑处理
  2. c语言sqlserver进行odbc编程,在VS下用C语言连接SQLServer2008
  3. 只用一个marker 替换 高德_关于高德地图添加Marker遇到的一些坑
  4. MATLAB矩阵的分解与变换
  5. Java List相关用法
  6. LeetCode-118杨辉三角C++详解
  7. poj 2253 最短路变形——最大边的最小值
  8. 查看在Ubuntu上打印的大型JSON文件
  9. MATLAB 贪婪周边无状态路由协议(GPSR)路由仿真
  10. ajax获取301,PHP获取301重定向页面跳转后真实URL地址