1

I'm using xampp to run mysql, and I've created a database for a lost and found website.

The database is really simple, only two tables are used: students & lost_items

I am trying to insert data into the students table, but it keeps saying that this table is read only. I've read some solutions and they said I need to use sudo and set the group privileges, but where do I put in these commands?

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
alex067
  • 3,159
  • 1
  • 11
  • 17
  • Where do I enter this command? – alex067 Dec 05 '16 at 09:45
  • Are you running Windows or Unix? – Tim Biegeleisen Dec 05 '16 at 09:48
  • running windows 10 – alex067 Dec 05 '16 at 09:48
  • What you have read is not match to your needs because you are running Windows and `sudo` is a command for Unix and Unix-like operating system. – Hermanto Dec 05 '16 at 09:53
  • so how do I solve this problem if im using windows – alex067 Dec 05 '16 at 09:54
  • What engine are you using? Run `SHOW CREATE TABLE STUDENTS` and update your question. – Hermanto Dec 05 '16 at 09:59
  • There can be multiple reason for this issue 1) Check the user you are using have all required permission granted 2) Try checking with database engine it might creating an issue. few ref. article for existing issue http://stackoverflow.com/questions/32161224/1036-table-is-read-only-in-phpmyadmin http://stackoverflow.com/questions/9575914/table-is-read-only , hope any of this can give you some idea – Rupal Javiya Dec 05 '16 at 11:38

2 Answers2

4

I had same problem in ubuntu and xampp.

  1. In file config, after block innodb set --> innodb_force_recovery = 1
  2. sudo chmod 777 -R /opt/lampp/var/mysql
  3. Сomment out line #innodb_force_recovery = 1
  4. restart MySQL
Ivan Pirus
  • 1,026
  • 11
  • 21
0

Get your data directories by following commands.

sudo cat /etc/mysql/my.cnf | grep -i datadir

or sudo cat /etc/my.cnf | grep -i datadir

sudo chown -cR mysql:mysql /Path/mysql/datadir/

And restart mysql process

/etc/init.d/mysql stop
/etc/init.d/mysql start 

Hope this helps.

Faizan Younus
  • 793
  • 1
  • 8
  • 13