Science, Python, Travel, Other Curiosities, and Notes To Self

MySQL notes

sudo mysqld_safe
sudo mysqladmin shutdown
sudo mysql
GRANT ALL ON menagerie.* TO 'user'@'localhost';
\q
mysql
SELECT USER();
CREATE DATABASE menagerie;
USE menagerie;
SELECT DATABASE();
CREATE TABLE pet (name VARCHAR(20), owner VARCHAR(20),
-> species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
SHOW TABLES;
DESCRIBE pet;
  • Secure the MySQL accounts. See 5.3.1. General Security Guidelines
  • See Chapter 10: Data Types
  • Delimiter can be specified in the LOAD DATA statement
  • When writing tab-delimited files with Vim, set noexpandtab
  • Pick up from 3.3.4.6. Working with NULL values
  • Databases are stored in /usr/local/mysql/data
  • User configuration file is ~/.my.cnf

After installing from the Mac OS X PKG Installer, you can use a different data directory for your databases:

Read More