Skip to content

Latest commit

 

History

History
111 lines (84 loc) · 1.4 KB

File metadata and controls

111 lines (84 loc) · 1.4 KB

Install

Ubuntu / Debian

Install

Update package list

sudo apt update

Install MySQL server

sudo apt install mysql-server -y

Verify installation

mysql --version

Expected output: mysql Ver 8.0.45-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu))

Start MySQL

sudo systemctl start mysql

Stop MySQL

sudo systemctl stop mysql

Restart MySQL

sudo systemctl restart mysql

Check status

sudo systemctl status mysql

Enable auto-start on boot

sudo systemctl enable mysql

Secure MySQL Installation

Run the security setup:

sudo mysql_secure_installation

Recommended options:

  • Set root password → Yes
  • Remove anonymous users → Yes
  • Disallow remote root login → Yes
  • Remove test database → Yes
  • Reload privilege tables → Yes

CentOS / RHEL

sudo yum install mysql-server

or

sudo dnf install mysql-server

Windows

Download installer from: MySQL Community Downloads.

Install:

  • MySQL Server
  • MySQL Workbench (recommended GUI)
  • MySQL Shell

macOS

Using Homebrew:

brew install mysql

Start service:

brew services start mysql

Login to MySQL

Login as root

sudo mysql

or

mysql -u root -p

Exit from MySQL

EXIT();