I am working as admin on a Windows 7 PC with XAMPP Server and Mysql QueryBrowser. The database is storage only, nobody writes in it or reads from it except me.
These statements work as expected:
Select Col1, Col2, Col3 from Table1
Select Col1, Col2, Col3 from Table1 Group by Col1
Each of the following statements
Select Col1, Col2, Col3 from Table1 Group by Col2
Select Col1, Col2, Col3 from Table1 Group by Col3
Select Col1, Col2, Col3 from Table1 Group by Col1,Col2,Col3
gives the following output
#1036 - Table 'Table1' is read only
There is an index on Col1 and Col2 but not on Col3. How can that be?
EDIT: I found out that it has nothing to do with GROUP BY. It is even more strange as can be seen from these simple queries:
SELECT count(*) FROM Table1 where Col2 > 3000;
EXPLAIN SELECT count(*) FROM Table1 where Col2 > 3000;
+----+-------------+----------------+-------+-----------------+--------+----- +------+----------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------+-------+-----------------+--------+---------+------+----------+--------------------------+
| 1 | SIMPLE | Table1 | range | Col2,Col7 | Col2 | 4 | NULL | 22315581 | Using where; Using index |
+----+-------------+----------------+-------+-----------------+--------+---------+------+----------+--------------------------+
works fine. However,
SELECT count(*) FROM Table1 where Col4 > '2009-01-01';
EXPLAIN SELECT count(*) FROM Table1 where Col4 > '2009-01-01';
+----+-------------+----------------+------+---------------+------+---------+------+-----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------+------+---------------+------+---------+------+-----------+-------------+
| 1 | SIMPLE | Table1 | ALL | NULL | NULL | NULL | NULL | 237089257 | Using where |
+----+-------------+----------------+------+---------------+------+---------+------+-----------+-------------+
gives the error
ERROR 1036 (HY000): Table 'Table1' is read only
I am thankful for @Michael - sqlbot's input and also added the EXPLAIN ...
output. However, there how can one column cause potential problems with the filesystem permissions and the other column does not? I checked the mysql_error file in the XAMPP directory but I found nothing that helped me.