Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
When you first install MySQL on Mac OS X using the native binaries from MySQL, the root user is created with a blank password. You typically want to create a password for the root user before starting on your development work. Here is how you can do it. First make sure that MySQL is running. I'll go to the System Preferences pane and click Start MySQL Server. If prompted type in your administrator password. Then I'll go to Terminal.
In Terminal I'll switch to the directory that contains the MySQL binaries. I'll type cd /USR/local/mysql/bin. I'll type ls and show you that there's a list of available applications. Now to confirm that the root user can be used without a password, type in this command, ./mysql -u root.
That's the name of the root user. When you press return it should start the MySQL monitor without prompting you for a database password. If you see this then you are confirming that the root user is set up without a password. Type exit and then press Return to exit the monitor. Here is the command to set a root user. password. ./mysqladmin -u root. That means I'm using the SQL administrative tool as the root user.
Then I'll type password and the string that I want to set the password to. I'll type in the string password. I'll press Return and now the root user password has been set. If you then try to enter the MySQL monitor again, access will be denied. I'll type in ./mysql -u root and I get an access denied message. So now that you've installed MySQL and configured the root user with a password, you're ready to start using the database from your selected MySQL client.
In the last video of this chapter, I'll show you how to install and use an application from MySQL called MySQL Workbench that will let you connect to your server and create some simple data.
Get unlimited access to all courses for just $25/month.Become a member