notes/mysql-setup.Rmd

Setting up MariaDB

Install

brew install mariadb
mysql_install_db --verbose --user=hadley --basedir=/usr/local \
  --datadir=/User/hadley/db/mariadb --tmpdir=/tmp

mysqld --datadir='/Users/hadley/db/mysql'

mysql -u root -e "CREATE DATABASE lahman;"
mysql -u root -e "CREATE DATABASE nycflights13;"
mysql -u root -e "CREATE DATABASE test;"

Start

mysqld --datadir='/Users/hadley/db/mysql'

Connect

install.packages("RMySQL") library(RMySQL) drv <- dbDriver("MySQL") con <- dbConnect(drv, dbname = "lahman", username = "root", password = "") dbListTables(con)

Shut down

mysqladmin shutdown -u root -p