This repository offers a detailed guide to MySQL, one of the most popular relational database management systems. It covers installation, basic usage, and best practices for managing and securing your MySQL databases.
- Basic knowledge of SQL
- A machine with administrative access to install MySQL
-
Windows:
- Download the MySQL Installer from MySQL Downloads and follow the installation wizard.
-
macOS:
- Use Homebrew:
brew install mysql
- Use Homebrew:
-
Linux (Ubuntu):
- Install MySQL using APT:
sudo apt update sudo apt install mysql-server
- Install MySQL using APT:
After installation, run the mysql_secure_installation script to secure your database.
-
Windows:
- Use the MySQL Workbench or start/stop from the Services panel.
-
macOS and Linux:
- Start:
sudo systemctl start mysql
- Stop:
sudo systemctl stop mysql
- Start:
-
Create a Database:
CREATE DATABASE mydatabase;
-
Select a Database:
USE mydatabase;
-
Create a Table:
CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), email VARCHAR(255));
-
Insert Data:
INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com');
-
Query Data:
SELECT * FROM users;
-
Update Data:
UPDATE users SET email = 'newjohn@example.com' WHERE id = 1;
-
Delete Data:
DELETE FROM users WHERE id = 1;
- Regularly back up your databases.
- Use strong, unique passwords for database accounts.
- Regularly update MySQL to keep your software up to date with security patches.
We welcome contributions that improve the documentation, add new examples, or enhance the MySQL guide. Please fork this repository, make your changes, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.