Skip to content

Instantly share code, notes, and snippets.

@AmrMekkawy
Last active January 1, 2018 22:58
Show Gist options
  • Save AmrMekkawy/9065d1c9c0b3afdab72760c5f29a2772 to your computer and use it in GitHub Desktop.
Save AmrMekkawy/9065d1c9c0b3afdab72760c5f29a2772 to your computer and use it in GitHub Desktop.
How to access MySQL through Vagrant?

How to access MySQL through Vagrant?

# Go to the root of your project
cd /path/to/your/project/root

# Enter vagrant
vagrant ssh

# Access MySQL
mysql
# or connect to MySQL as the homestead user (password is: secret)
mysql -u homestead -p

# Execute any mysql-related commands (see the below examples)..

# Show all existing databases
show databases;

# Create a new database
CREATE DATABASE database_name;

# Delete an existing database
DROP DATABASE database_name;

# Select a database to deal with
USE database_name;

# Show all tables of the current database
SHOW tables;

# To exit from MySQL execute the next command..
exit
# To exit from vagrant execute the next command..
exit

How to access MySQL through Vagrant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment