Here I want to describe tutorial which works on my Mac. MySQL version: mysql Ver 14.14 Distrib 5.7.20, for macos10.12 (x8664) using EditLine wrapper Mac OS version: Sierra 10.12.6. Please take care about root access in production environment. I’m feel free to connect to my MySQL db using root because it is my development environment. I just installed MySQL on Mac OS X. The next step was setting the root user password, so I did this next: Launch the terminal app to access the Unix command line. Under the Unix prompt I executed.
As mentioned before, the recommended way of gaining super user privileges from the command line in macOS is the sudo command. The name means ‘super user do’ and will perform the following command with root privileges after verifying the user running sudo has the permission to do so. Part 1: Demystifying root; Part 2: The sudo Command (this post); Part 3: root and Scripting. However you can enable the root account and set a password for it. To do so use: sudo passwd root Firstly you will be asked for your current user password and after this you will be asked for the new password twice (new and retype password) as your new root password. For more information see RootSudo - Community Ubuntu Documentation. In light of the recent security concerns with macOS that allows anyone to easily gain root access (https://9to5mac.com/2017/11/28/how-to-set-root-password/).
The user account named ”root” is a superuser with read and write privileges to more areas of the system, including files in other macOS user accounts. The root user is disabled by default. If you can log in to your Mac with an administrator account, you can enable the root user, then log in as the root user to complete your task.
Mac Sudo Password
The root user account is not intended for routine use. Its privileges allow changes to files that are required by your Mac. To undo such changes, you might need to reinstall your system software. You should disable the root user after completing your task.
It's safer to use the
sudo
command in Terminal instead of enabling the root user. To learn about sudo
, open the Terminal app and enter man sudo
.Enable or disable the root user
- Choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
- Click , then enter an administrator name and password.
- Click Login Options.
- Click Join (or Edit).
- Click Open Directory Utility.
- Click in the Directory Utility window, then enter an administrator name and password.
- From the menu bar in Directory Utility:
- Choose Edit > Enable Root User, then enter the password that you want to use for the root user.
- Or choose Edit > Disable Root User.
Log in as the root user
Password For Root Mac Os High Sierra
When the root user is enabled, you have the privileges of the root user only while logged in as the root user.
- Choose Apple menu > Log Out to log out of your current user account.
- At the login window, log in with the user name ”root” and the password you created for the root user.
If the login window is a list of users, click Other, then log in.
Remember to disable the root user after completing your task.
Change the root password
- Choose Apple menu () > System Preferences, then click Users & Groups (or Accounts).
- Click , then enter an administrator name and password.
- Click Login Options.
- Click Join (or Edit).
- Click Open Directory Utility.
- Click in the Directory Utility window, then enter an administrator name and password.
- From the menu bar in Directory Utility, choose Edit > Change Root Password…
- Enter a root password when prompted.