Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 1005 "Can't create table (errno: 13)"

Tags:

mysql

django

I am trying to do a migration with Django to a MySQL database, but I am receiving this error:

(1005, "Can't create table '#sql-60_f71' (errno: 13)")

I have done several migrations before to this database and this is the first time I am seeing this error. The thing that really confuses me is that my migration isn't even creating a table. Here is what the migrations look like:

operations = [
    migrations.AddField(
        model_name='inverter',
        name='custom_name',
        field=models.CharField(blank=True, default=b'', max_length=30),
    ),
    migrations.AlterField(
        model_name='status',
        name='generic_name',
        field=models.CharField(default=b'Status', max_length=20),
    ),
]
like image 942
keverly Avatar asked May 12 '16 00:05

keverly


1 Answers

Found the answer here https://stackoverflow.com/a/4037158/5285571. I was having trouble because my database was not located at /var/lib/mysql. I ended up having to do sudo chown -R mysql:mysql /usr/local/mysql/data/my_database.

like image 146
keverly Avatar answered Nov 19 '22 23:11

keverly