使用MYSQL数据库

markdown
阅读 47 收藏 0 点赞 0 评论 0

mysql.md
## Using MYSQL Database
### Install using homebrew: `brew install mysql`

```
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To have launchd start mysql now and restart at login:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  mysql.server start (stop, restart, status)

```

* To connect: `mysql -u root`
    * The `-u` says login as user `root` 
* To exit: `exit`
 
### Set default mysql password
* Run in command line: `msqladmin -u root password`
* Then it will prompt you for a new password!
*  **Once you've set a password, you will need to run `mysql -u root -p` to login**

### Install ruby gem mysql
* `gem install mysql2`, not `mysql`

---
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号