How to Configure and Initialize MySQL (8 or later version) on Windows without Installation
If you need to use MySQL on Windows but don't want to go through the hassle of installing it, you can still use it by downloading the ZIP archive version of MySQL. Here are the steps to configure and initialize MySQL:
- Download the latest ZIP archive for Windows from the official MySQL website (https://dev.mysql.com/downloads/mysql/).
- Extract the ZIP archive to a folder of your choice (e.g., C:\mysql).
- Create a new file named my.ini in the MySQL folder (e.g., C:\mysql) with the following content:
[mysqld] basedir=C:/mysql datadir=C:/mysql/data port=3306
Make sure to replace the basedir and datadir values with the path to your MySQL folder.
- Create a new folder named data inside the MySQL folder (e.g., C:\mysql\data).
- Open a command prompt as an administrator and navigate to the MySQL folder (e.g., cd C:\mysql).
- Initialize the MySQL data directory by running the following command:
bin\mysqld --initialize-insecure --console
The --initialize-insecure option will initialize the data directory without setting a root password, so you can access the MySQL server without a password. The --console option will display the initialization process in the console window.
- Start the MySQL server by running the following command:
bin\mysqld --console
The --console option will display the MySQL server output in the console window.
- Open another command prompt as an administrator and navigate to the MySQL folder (e.g., cd C:\mysql).
- Connect to the MySQL server by running the following command:
bin\mysql -u root
This will connect you to the MySQL server as the root user without a password.
- Set a root password by running the following command:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Replace new_password with your desired root password.
That's it! You have now successfully configured and initialized MySQL on Windows without installation.
________________________________________________________
OLDER GUIDE
mysql 5.7> simple initialization and password setting without installation - no configuration needed
Note: this works for mysql version 5.7>
Download (almost) any zip package of mysql
ex.: I download mysql-5.7.26-winx64.zip
Unzip the content in the directory that you prefer.
ex.: G:\mysql-5.7.26-winx64\
Download this zip file
Extract the batch files and copy them in your mysql folder (data folder should be missing - and it's ok)
You can run "mysql-first-run.bat" to initialize the data folder and set the default password for the "root" user.
The password will be: toor
If everything is ok you can run "mysql_start.bat"
A command prompt will pop up.
To close the mysql server just press ctrl+C from the prompt.
Comments
Post a Comment