Install MySQL server and client packages on major operating systems quickly and securely.
Run sudo apt update && sudo apt install mysql-server
. The meta-package pulls the latest GA server, client tools, and dependencies, letting you start MySQL with systemd immediately after setup.
Execute brew update && brew install mysql
. Homebrew places binaries under /opt/homebrew/Cellar/mysql/
and adds a launchd plist for auto-start. Initialize the data directory with mysql_secure_installation
.
Run sudo mysql_secure_installation
.Choose a strong root password, remove anonymous users, disallow remote root login, and delete the test database. These harden the fresh instance.
Check with sudo systemctl status mysql
(Linux) or brew services list
(macOS). You should see “active (running)”. If down, start it using the same service manager.
Login using mysql -u root -p
and run the SQL example shown below.It sets up Customers
, Orders
, Products
, and OrderItems
for immediate testing.
Use apt upgrade mysql-server
, yum update mysql-community-server
, or brew upgrade mysql
monthly. Staying current patches security flaws and improves performance.
.
Yes, use Docker containers or MySQL Sandbox to isolate ports and data directories. Package managers typically overwrite prior versions, so containers are safer.
Port 3306. Change it in mysqld.cnf
if the port is already in use or you need multiple instances.