Skip to content

manujajay/MySQL-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

MySQL Guide

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.

Prerequisites

  • Basic knowledge of SQL
  • A machine with administrative access to install MySQL

Installation

Installing MySQL on Various Platforms

  1. Windows:

    • Download the MySQL Installer from MySQL Downloads and follow the installation wizard.
  2. macOS:

    • Use Homebrew:
      brew install mysql
  3. Linux (Ubuntu):

    • Install MySQL using APT:
      sudo apt update
      sudo apt install mysql-server

Securing MySQL Installation

After installation, run the mysql_secure_installation script to secure your database.

Basic Usage

Starting and Stopping MySQL Server

  • 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

Basic SQL Commands

  • 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;

Best Practices

  • 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.

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published