dugong191's avatar

How to create new MySQL user under homestead?

How to create new MySQL user, witl previlages, under homestead?

0 likes
4 replies
michaeldyrynda's avatar

Open a mysql prompt

> mysql -u homestead -p

Add the user

mysql> GRANT ALL PRIVILEGES ON `tablename`.* TO 'username'@'%' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;

You can run the same commands using whatever MySQL GUI you're using now if you wish.

Any particular reason you're using separate users within homestead?

2 likes
jekinney's avatar

I set up a myadmin.app URL and file in which I installed phpmyadmin to do all my database stuff. Just to make my life easier. With that you can do all that you require with a few clicks.

christopher's avatar

I you`re on a mac you could connect to the database straight forward with sequel pro.

Otherwise log in to your homestead box with

homestead ssh

Or if you dont using homestead 2.0 go to your vagrant folder an do

vagrant ssh

Then log in to your mysql. The password should be "secret".

> mysql -u homestead -p

And create the new user

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
quit
4 likes

Please or to participate in this conversation.