MySQL Tutorials - Herong's Tutorial Examples - v4.46, by Herong Yang
%mysql% Variable for MySQL Server Path
Tutorial example on how to create an environment variable '%mysql%' to represent the MySQL Server directory path name. This gives a quick way to invoke a MySQL command like '%mysql%\bin\mysql'.
Once MySQL Server is installed, we need to remember in which directory MySQL Server program and tools are located.
If you used the MySQL Installer to install MySQL, the server program and tools are located in the "C:\Program Files\MySQL\MySQL Server 8.0" directory.
If you used the MySQL Non-Install ZIP package to install MySQL, the server program and tools are probably located in the "C:\local\mysql" directory.
If you want to avoid typing the server directory path, you put it in an environment variable like "%mysql%" as shown below:
1. Go to "Control Panel > System and Security > System".
2. Click "Advanced system settings". Then click "Environment Variables".
3. Click "New" and enter:
Variable name: mysql Variable value: "C:\Program Files\MySQL\MySQL Server 8.0" or: Variable name: mysql Variable value: "C:\local\mysql"
4. Click "OK" to save the change.
Open a new command line window to invoke the "mysqladmin" tool:
herong> %mysql%\bin\mysqladmin --user=root --password=TopSecret status Uptime: 9831 Threads: 3 Questions: 6557 Slow queries: 0 Opens: 303 Flush tables: 3 Open tables: 192 Queries per second avg: 0.666
Good. The environment variable "%mysql%" is working.
Table of Contents
►MySQL Introduction and Installation
Downloading and Installing MySQL
Issues during MySQL Installation
Starting and Stopping MySQL Server
MySQL Command Line Client Tool
Using MySQL Non-Install Package
MySQL Data Directory Initialization
Creating MySQL Windows Service
►%mysql% Variable for MySQL Server Path
Introduction of MySQL Programs
Perl Programs and MySQL Servers
Java Programs and MySQL Servers
Character Strings and Bit Strings
Table Column Types for Different Types of Values
Using DDL to Create Tables and Indexes
Using DML to Insert, Update and Delete Records
Using SELECT to Query Database
Window Functions for Statistical Analysis
Use Index for Better Performance
Transaction Management and Isolation Levels
Defining and Calling Stored Procedures
Variables, Loops and Cursors Used in Stored Procedures
System, User-Defined and Stored Procedure Variables
Storage Engines in MySQL Server
InnoDB Storage Engine - Primary and Secondary Indexes
Performance Tuning and Optimization
Installing MySQL Server on Linux