Last active
June 13, 2017 21:56
-
-
Save javierluraschi/39091f7db53219d7fd34360a3a38a4f5 to your computer and use it in GitHub Desktop.
Installing and Initializing MySQL in OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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