database Flashcards
basic database structure
Basic structure (tables, fields, entries) The table is the core structure of a relational database. Tables are made up of fields (columns) and entries (rows). Each table should represent a type of object (eg. a table for pets). Each field should represent a trait or descriptor of the object represented by the table (eg. the pets table might have fields for animal type and neutered state). Each entry represents one instance of the object. (eg. each entry is one pet).
relational database
This is a course about database management. But what is a database? A database is a structured set of data. The structure can be anything, but the most common form of database is a relational database. A relational database is a database made up of tables, where each row in the table has a unique key.
database engines
There are two storage engines for MySQL/MariaDB commonly used on cPanel servers: InnoDB and MyISAM. MyISAM was the default until MySQL 5.5.5, when InnoDB became the default. MyISAM is faster, and has the benefit of being portable (moving the files moves the database), but InnoDB has more advanced features.
indexes and queries
MySQL uses indexes for both InnoDB and MyISAM tables. An index is a special data structure that makes lookups on large tables faster. A query is when you ask the database to find some information for you. Queries for MySQL/MariaDB are made in Structure Query Language (usually seen as SQL). SQL is used by many database engines.
grants
Since databases are used by many users who shouldn’t necessarily have access to each others data, MySQL/MariaDB has mechanisms in place to prevent the unauthorized reading and writing of data. This is done with “grants”, which grant specific privileges on a specific table to a specific user on a specific host. There are many types of grants, for the different types of operations that can be performed.
config files
/etc/my.cnf
/root/.my.cnf
where the database mapping is stored
review what database mapping is again
reference the WHM db mapping tool
/var/cpanel/databases
where temporary files used for large queries go
required for innodb to start
/tmp
database files themselves
directories for databases
innodb files - ibdata, ibd (data), tablespaces
myisam files - MYD (data), MYI (index), and frm (format)
/var/lib/mysql
Let’s find all the databases that start with “animals” on this server:
show databases like “animals%”;