MySQL Flashcards
How do you start MySQL on Linux?
/etc/init.d/mysql start
Explain the difference between mysql and mysqli interfaces in PHP?
mysqli is the object-oriented
version of mysql library functions.
What does tee command do in MySQL?
tee followed by a filename turns on MySQL logging to a specified
file. It can be stopped by command notee.
How do you change a password for an existing user via mysqladmin?
mysqladmin -u root -p password
“newpassword” or mysql command: set password for ‘username’@’localhost’ = password(‘newpassword’);
Use mysqldump to create a copy of the database?
mysqldump -h mysqlhost -u username -p
mydatabasename > dbdump.sql
Explain advantages of InnoDB over MyISAM?
Row-level locking, transactions, foreign key constraints and crash recovery.
Explain advantages of MyISAM over InnoDB?
Much more conservative approach to disk space
management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB. InnoDB COUNT(*)s execute slower than in MyISAM due to tablespace complexity.
Explain federated tables.
Introduced in MySQL 5.0, federated tables allow access to the tables located on other
databases on other servers. CREATE TABLE t1 ( a int, b varchar(32)) ENGINE=FEDERATED
CONNECTION=’mysql://user@hostname/test/t1’