sudo su to start
mysql and do some homework with it.
When I finish with
mysql (or any other command), then I'm still in
How do I "log out", so my prompt changes back from
migrated from stackoverflow.com Apr 5 '12 at 18:03
This question came from our site for professional and enthusiast programmers.
You don't need to use
It's reccomended to use
to get back to your user level (or a different user)
Or just press Ctrl-D to exit out of root
There isn't any reason to use
Hopefully, your MySQL root account has a password, and you'll need to use the second form.
Other than that, if you need to run MySQL under sudo (e.g., for file permissions) then do it like this:
You can leave out the arguments (sudo will default to user root, MySQL will default to using the same user as sudo).