How to create new MySQL user under homestead? How to create new MySQL user, witl previlages, under homestead?
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?
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.
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
Please sign in or create an account to participate in this conversation.