Im having a little problem in using mysql on windows. I know how to create a new user and giving grants to the new user and all. But i don't know how to switch to new user from mysql console!
How do I switch users in MySQL workbench? Within the connection tab, do one of the following: Click Users and Privileges from the Management list within the Navigator area. Click Server and then Users and Privileges from the menu.
For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it. ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; Save the file to disk.
Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.
You have to exit and log in again using the new username.
From shell:
mysql --user=user_name --password=your_password db_name
Reference:
Once you have your new user created, try changing your default shortcut to log in as that user directly instead.
Go to Start Menu > MySql x.x Command Line Client > right-clicked > Properties > Target and changed the user (from -uroot
) to -uyournewuser
:
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" "-uroot" "-p"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With