Saturday, 8 August 2015

Install MySQL

I also find myself needing to install MySQL 5.6.25 as well for my classes. Step by step how to install...

1. Visit mysql's website and obtain a copy of mysql-5.6.25-winx64.zip (standalone zip file, NOT the installer).

2. Extract it to the desired drive. In my case this is drive G. Rename to mysql.
3. Create an option file with the following contents and save it to G:/mysql/my.ini
[mysqld]

# basedir to installation path
basedir=G:/mysql

# location of data directory
datadir=G:/mydb/data

4. Ensure both the basedir and the datadir exist, creating them if necessary.
5. Copy the contents of directory G:/mysql/data/ to G:/mydb/data/. This gets you an empty database. (if you don't follow this step you will get an error [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist)

6. Start mysql
cd /d G:
mysql\bin\mysqld --console


Output should end with:
2015-06-13 16:56:04 1388 [Note] mysql\bin\mysqld: ready for connections.
Version: '5.6.25'  socket: ''  port: 3306  MySQL Community Server (GPL)


7. Open a new command prompt and login to the database
G:\>mysql\bin\mysql --user=root
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)

If you see database "mysql" all is well.

Now you can do whatever you need to with the new database, or create another database/schema if you wish.

No comments:

Post a Comment