简体   繁体   中英

MariaDB / MySQL pre-existing DB's

I was wondering what these three pre-existing Database are for?

information_schema
mysql
performance_schema

I am interested to know whether or not I can remove them in a minimalistic environment without worrying about any ramifications.

Mysql will foolishly allow you to drop mysql and performance_schema but not information schema. However, You SHOULD NOT remove these Database because Mysql will stop function properly.

For example if you remove the mysql database, you will still be able to log in as root and run 'show databases; but if you try to run show tables; in a database, You will get an empty set.

You can, however,restrict who sees them based on user permissions and grants.

From dev.mysql :

Tables in the performance_schema database are a collection of views and temporary tables that do not store data permanently.

The Performance Schema provides a way to inspect internal execution of the server at runtime. It is implemented using the PERFORMANCE_SCHEMA storage engine and the performance_schema database. The Performance Schema focuses primarily on performance data. This differs from INFORMATION_SCHEMA, which serves for inspection of metadata.

You can run this command and get info about threads:

select name, type, instrumented from performance_schema.threads;

From dev.mysql :

INFORMATION_SCHEMA is a database within each MySQL instance, the place that stores information about all the other databases that the MySQL server maintains. The INFORMATION_SCHEMA database contains several read-only tables. They are actually views, not base tables, so there are no files associated with them, and you cannot set triggers on them. Also, there is no database directory with that name.

You can run this command to see which databases have MyISAM Tables:

select distinct(table_schema) FROM information_schema.tables where engine = 'MyISAM';

From dev.mysql .

The mysql system database includes several grant tables that contain information about user accounts and the privileges held by them.

You can run this command to see a list of users and host:

select user, host from mysql.user;

You can't remove these databases. If you alter tables or otherwise change things in them you may corrupt your server.

They are "fake" databases, used for metadata. They don't take much space.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM