Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save javierluraschi/39091f7db53219d7fd34360a3a38a4f5 to your computer and use it in GitHub Desktop.
Save javierluraschi/39091f7db53219d7fd34360a3a38a4f5 to your computer and use it in GitHub Desktop.
Installing and Initializing MySQL in OS X
Install MySQL in OS X using brew: `brew install mysql`, start the service `mysql.server start` and login with `mysql -uroot` to create a database as follows:
```{sql}
CREATE DATABASE sparklyr;
USE sparklyr;
CREATE TABLE `person` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(30) DEFAULT NULL,
`last_name` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`)
);
INSERT INTO person(first_name, last_name) VALUES("Barack", "Obama");
INSERT INTO person(first_name, last_name) VALUES("Bill", "Clinton");
ALTER USER 'root'@'localhost' IDENTIFIED BY '<password>';
QUIT;
```
Once the instance is no longer needed, stop the MySQL service by running `mysql.server stop`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment