Hyperz Documentation > Knowledgebase > Guides > MySQL Install Guide

MySQL Install Guide

Hyperz

This guide will explain how to INSTALL MySQL on different OS's


AVAILABLE OS's


Windows

Required Programs:


XAMPP:

  • Go through the installer for XAMPP as you normally would.
  • When complete, click the checkbox here:
  • Then click the small start buttone here:

This should get the program to start using MySQL, and it should start console logging something like the below screenshot:


HeidiSQL:

  • First thing is to open HeidiSQL.
  • It may look like this:
  • So put hit new then put a name or something.
  • The login details may be the same like this:
    Hostname/IP = localhost, Username = root, Password = <Nothing>, Port = 3306
  • Once the details have been entered then hit open.
  • It may look like this:
  • Right click on this bit:
  • Then hit Create New then click New Database
  • In the box put a database name you prefer then click ok
  • Once the database has been made click files at the top left.
  • Then hit load sql file or press CTR + Oand choose all the sql files you need to execute.
  • Then it should look like this
  • Then press the blue play button
  • This will load all the tables and make then in your database.

Linux Ubuntu

Start off by running this command to install the base of MySQL:
sudo apt install mysql-server

When prompted press Y to install MySQL-Server.

Then lets login to MySQL:
sudo mysql

Then, lets set a password for your new MySQL Server!

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Changing your MySQL Password in Linux Ubuntu

  • Run mysql -u root -p
  • Enter your current password
  • Enter the following commands
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SETYOURPASSWORDHERE';
FLUSH PRIVILEGES;
  • Then your password will be changed!

Create A MySQL Database

  • Run mysql -u root -p
  • Enter your current password
  • Enter the following command: CREATE DATABASE databasenamehere;
  • Then you have made a MySQL Database

Import an SQL File

  • Run mysql -u root -p
  • Enter your current password
  • Make sure you already have a database created
  • Enter the following commands
use databasename;
source /path/to/your/file.sql
  • To check that all the tables have been imported, run: SHOW TABLES;
  • Then you're done!

Backup all databases

If you're using a password for your SQL server just run this command:

mysqldump -u root -p --all-databases > all_databases.sql

If you are not using a password, this should work just fine:

mysqldump --all-databases > all_databases.sql

Restore MySQL Origin Permissions

Sometimes MySQL will have permission denied errors when running queries, use this command to resolve those.

sudo chown -R mysql:mysql /var/lib/mysql
sudo chown -R mysql:mysql /home
sudo chown -R mysql:mysql /

Was this article helpful?

106 out of 214 found this helpful