Spex3
    

Installing and Configuring MySQL 🛢️⚙️


    

    

Installing and Configuring MySQL 🛢️⚙️

1️⃣ Installing MySQL
✅ Installation on Windows
Download MySQL

Go to the official MySQL website.

Download MySQL Community Server (free version).

Run the Installer

Choose "Custom" or "Developer Default" setup.

Install MySQL Server, MySQL Workbench, and MySQL Shell (optional).

Configure MySQL Server

Select Standalone MySQL Server.

Set root password for authentication.

Choose default port 3306.

Complete the setup and start the MySQL service.

✅ Installation on macOS
Install via Homebrew (recommended):


brew install mysql

Start MySQL:


brew services start mysql


Set root password:


mysql_secure_installation


✅ Installation on Linux (Ubuntu/Debian)
Update Package List:

 
sudo apt update


Install MySQL Server:

 
sudo apt install mysql-server


Secure the Installation:

 
sudo mysql_secure_installation


Start MySQL:

 
sudo systemctl start mysql


2️⃣ Configuring MySQL
✅ Editing MySQL Configuration File
Located at:

Windows: C:\ProgramData\MySQL\MySQL Server 8.0\my.ini

Linux/macOS: /etc/mysql/my.cnf

Common settings:

 
[mysqld]
port = 3306
max_connections = 100
bind-address = 127.0.0.1


✅ Creating a New MySQL User
 
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;


3️⃣ MySQL Command-Line Interface (CLI)
✅ Logging into MySQL
 
mysql -u root -p


✅ Basic Commands
 
SHOW DATABASES;
USE database_name;
SHOW TABLES;
DESCRIBE table_name;


✅ Creating a Database
 
CREATE DATABASE mydatabase;

USE mydatabase;


✅ Creating a Table
 
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(100)
);


✅ Inserting Data

INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');


✅ Fetching Data
 
SELECT * FROM users;


4️⃣ MySQL GUI Tools
✅ 1. MySQL Workbench (Official)
Visual interface for managing MySQL.

Features:

Query Editor

Database Design

Server Administration

Download: MySQL Workbench

✅ 2. phpMyAdmin
Web-based tool for managing MySQL.

Comes with XAMPP, WAMP, or LAMP stacks.

Access via http://localhost/phpmyadmin

✅ 3. DBeaver
Open-source database management tool.

Supports multiple databases including MySQL.

🎯 Summary
✔ MySQL can be installed on Windows, macOS, and Linux.
✔ Configuration includes user management, security settings, and performance tuning.
✔ MySQL CLI is used for direct database interaction.
✔ GUI tools like MySQL Workbench simplify database management.


    Date: 2025-03-28 00:00:00.000000