Skip to content

Instantly share code, notes, and snippets.

@beninada
Last active August 1, 2019 22:25

Revisions

  1. beninada renamed this gist Aug 1, 2019. 1 changed file with 4 additions and 0 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    # Connect to MySQL running in Vagrant

    Source: https://coderwall.com/p/yzwqvg/connect-to-mysql-in-vagrant-with-sequel-pro

    First, vagrant ssh and add a user that can connect from anywhere.

    ```
  2. beninada created this gist Aug 1, 2019.
    23 changes: 23 additions & 0 deletions connect-to-mysql-on-vagrant.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    First, vagrant ssh and add a user that can connect from anywhere.

    ```
    mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION; FLUSH PRIVILEGES;"
    ```

    Next, find the address MySQL is bound to.

    ```
    cat /etc/mysql/my.cnf | grep bind-address
    ```

    This is the MySQL host you'll be connecting to.

    We'll be using the SSH connection tab in Sequel Pro. The username is root. By default, no password is required.

    Vagrant's default SSH settings are as follows:
    * SSH Host: 127.0.0.1
    * SSH User: vagrant
    * SSH Key: ~/.vagrant.d/insecureprivatekey
    * SSH Port: 2222

    Enjoy!