Reputation: 1430
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),
),
]
Upvotes: 9
Views: 13580
Reputation: 155
I was also facing the same problem, but I figured out this one. I don't know how it worked.
But for god sake, it worked for me and I am not a professional in programming, but I am learning.
The first time I created the database using like "/var/lib/mysql then mkdir a", but it didn't work, so I created the database in MySQL instead manually at /var/lib/mysql, and then I created the table, and it worked for me.
mysql> create database a;
Query OK, 1 row affected (0.08 sec)
mysql> use a;
Database changed
mysql> create table a(Name char(21));
Query OK, 0 rows affected (0.27 sec)
Upvotes: 0
Reputation: 1430
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
.
Upvotes: 13