Notes

MySQL - Windows installation

author: Paul Kim

categories: mysql

tags: mysql

Install MySQL (using ZIP archive)

  1. Extract zip archive(s) to the desired install directory

    C:\mysql\mysql-5.6.44-winx64
    C:\mysql\mysql-5.7.26-winx64
    C:\mysql\mysql-8.0.16-winx64
  2. Optional: Extract debug-test archive if you plan to execute the MySQL benchmark and test suite
  3. Optional: Create an option file (my.ini or my.cnf) in C: drive (i.e., C:\my.ini).

    [mysqld]
    basedir     = C:/mysql
    datadir     = C:/mysql/data
  4. Add %MYSQL_HOME%\bin to PATH. For example, MYSQL_HOME points to C:\mysql\mysql-8.0.16-winx64.
  5. Open Command Prompt and initialize MySQL: Create the data directory and populate tables in the mysql system database

    # no password (just use this)
    mysqld --initialize-insecure
    
    # or temp password
    mysqld --initialize --console
    
    # other options
    mysqld --initialize --user=mysql
    mysqld --initialize --basedir=C:/mysql --datadir=C:/mysql/data
    mysqld --initialize --defaults-file=C:\my.ini
  6. Start MySQL:

    mysqld --console
  7. Open a new Command Prompt and secure MySQL:

    mysql_secure_installation
  8. Connect to MySQL:

    mysql -u root -p

Install MySQL as a service

# run as Administrator

# install MySQL as a service (just use this)
mysqld --install

# install MySQL as a manual service
mysqld --install-manual

# other options
mysqld --install MySQL --defaults-file=C:\my.cnf

Start/Stop MySQL service

# run as Administrator

sc query mysql
sc start mysql
sc stop mysql

net start mysql
net stop mysql

Remove MySQL service

# run as Administrator

# remove mysql service
mysqld --remove

sc delete mysql

Uninstall MySQL

  1. Remove %MYSQL_HOME%\bin from PATH environment variable
  2. Remove Inbound Rules for MySQL from Windows Firewall (wf.msc)

Test MySQL installation

mysqlshow -u root -p
mysqlshow -u root -p information_schema
mysqlshow -u root -p mysql
mysqlshow -u root -p performance_schema
mysqlshow -u root -p sys

mysqladmin -u root -p version status proc
Source

ChromeEdgeFirefoxOpera

© 2021 paulkode.com. All rights reserved.