Start using MySQL

Connect with the mysql client

Open an administrative command-line session, keep passwords out of shell history, and verify the server and matched account.

8 minute lesson

~~~

If the administrative account has a password, ask the client to prompt for it:

$(brew --prefix mysql@8.4)/bin/mysql -u root -p

Do not put the password after -p. That can expose it in shell history and process lists.

A fresh local Homebrew installation may initially use mysql -u root without -p. Follow the installation output, then secure the account before allowing network access.

Verify the server after connecting:

SELECT VERSION();
SELECT CURRENT_USER();

CURRENT_USER() shows the full MySQL account that matched the connection. Leave the client with QUIT;.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →