I am preparing a common schema
o database
that contains tables in common use across multiple projects. All MySQL users must have permission to run ONLY select
on those tables. For that I do:
drop database if exists common_schema;
CREATE DATABASE common_schema CHARACTER SET utf8 COLLATE utf8_general_ci;
grant select on common_schema.* to ""@"";
flush privileges;
use common_schema;
set foreign_key_checks = 0;
-- creación_de_tablas
-- inserts
-- foreign_keys
set foreign_key_checks = 1;
The entire operation is executed with a bash script that is as follows:
cat *.sql > sql_completo.sql1
mv sql_completo.sql1 sql_completo.sql
mysql -u root -p < sql_completo.sql
rm sql_completo.sql
This script concatenates all the SQL files and loads it into MySQL. The problem is that any user can insert, modify or delete records from common_schema
, which it shouldn't be.
I am using MySQL 5.6.51.
Thanks in advance!