0% found this document useful (0 votes)
293 views

MySQL WorkBench Installation Guide

This document provides instructions for installing MySQL Workbench on Windows. It outlines downloading the installer from the MySQL website, running the installation wizard, selecting MySQL Workbench as the application to install, and completing the installation process. On launching MySQL Workbench, it describes how to configure a new connection to a local MySQL server and run a simple test query to show databases. It also includes some preferences to configure and frequently asked questions about using MySQL Workbench.

Uploaded by

Bryan Lee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views

MySQL WorkBench Installation Guide

This document provides instructions for installing MySQL Workbench on Windows. It outlines downloading the installer from the MySQL website, running the installation wizard, selecting MySQL Workbench as the application to install, and completing the installation process. On launching MySQL Workbench, it describes how to configure a new connection to a local MySQL server and run a simple test query to show databases. It also includes some preferences to configure and frequently asked questions about using MySQL Workbench.

Uploaded by

Bryan Lee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

SMU Classification: Restricted

IS112 Data Management

MySQL WorkBench Installation guide

For MAC OS, proceed to Appendix B (on page 16)


For Windows OS, proceed with step 1 below

1. Go to the link https://dev.mysql.com/downloads/workbench/ .


2. Do note that the current version is 8.0.31 and the screenshots below are of version 8.0.27.
Installation steps are the same even with the older version, do proceed with the installation of the
latest version available.

And if you are running windows, choose the option as shown below, and click on “Go to Download
Page”

3. You will be taken to the page shown below. The first installer option accesses the internet to
download everything whereas the second option has everything pre-installed in the downloaded
file. Hence you see the second is a larger file. You can choose any one of these options.

Page 1
SMU Classification: Restricted

IS112 Data Management

4. If you come across this page, that prompts you to Login or Signup, you can choose to skip and
directly go to download. Click on the link “just start my download”

5. The installer .msi file starts downloading. It might take some time.

6. Go to the downloads folder, right click, and click install. Windows OS’ User Account Control might
seek your permission to install. Click “Yes” as many times as it is prompted. If you come across a
window that prompts for MySQL installer upgrade as shown below, click “No” and proceed.

Page 2
SMU Classification: Restricted

IS112 Data Management

7. The installer window opens. Follow the installation guidelines. Since we need only the MySQL
workbench, we could choose custom installation.
* If you have a previous version of SQL workbench installed you will not see this Setup Type page.
Please proceed to Appendix A (on page 15) to upgrade your MYSQL workbench.

8. At the next window that appears, choose MySQL Workbench in Applications Section as shown below
(move the chosen application to the right tab) and click Next. Your version shown will be MySQL
Workbench 8.0.31.

Page 3
SMU Classification: Restricted

IS112 Data Management

You could optionally choose to download “Samples and Examples” from Documentation section if
needed. In this guide we have not chosen that.

9. The installation runs a certain Check Requirements. MySQL WorkBench needs VC++ redistributables
to be installed on your system. Hence when you are prompted to install VC++, select the product,
click "Execute" and "Install" to the following screens below if encountered.

Page 4
SMU Classification: Restricted

IS112 Data Management

10. After VC++ redistributables are installed, follow the direction, and click “Next” to move on to install
the MySQL WorkBench application.

Page 5
SMU Classification: Restricted

IS112 Data Management

11. Click on “Execute” to start installtion of the “selected” applications.

The installation takes some time to complete. Click "Next".

12. Installation for MySQLWorkbench is complete. Since we have the option “Start MYSQL Workbench”
selected, MySQL Server starts, when you click on “Finish” below. (wait a few seconds)

Page 6
SMU Classification: Restricted

IS112 Data Management

Page 7
SMU Classification: Restricted

IS112 Data Management

Connection to MySQL Server using MySQL WorkBench


The following steps demonstrate how to start a connection to MySQL server using MySQL workbench.
Upon Launching MySQL WorkBench, you will come to a screen as shown below with a “connection” to
the server configured.

1. When MySQL Workbench is launched, a screen as shown below appears with a connection (boxed in
red) to the server configured.

2. If you want to create a new local connection to your MySQL Server, click on the plus button shown

On the window that appears,


(a) give any Connection Name say "My_Connection" or "local server" (without the quotes)

(b) Leave the Hostname and Port settings as default as shown above unless you had chosen
different Port number during installation
(c) Give your root account password (if any) by clicking on "Store in Vault"

If you click "Test Connection" you should get a successful pop-up window. If you click "OK" on the
above window (after testing the connection), a new connection will be created.

Page 8
SMU Classification: Restricted

IS112 Data Management

3. Double click on existing or new connection created, enter the password (SQL Server root password)
if any. MySQL Work Bench will be launched and connect the MySQL Server if the service is running.

4. You can run your SQL command in the Query editor space.

5. Click on the lightning symbol to run the command typed. The command that is run (and shown
below) is "show databases". The symbol (lighting with cursor) runs the command that is present
where the cursor is, whereas the symbol (just the lightning) runs all commands present on the
query window.

Congratulations! You have successfully installed, configured and run a query on MySQL Server &
MySQL WorkBench.

Page 9
SMU Classification: Restricted

IS112 Data Management

MySQL WorkBench Preferences


1. You could set workbench preferences by selecting the following menu option. Go to Edit,
Preferences

2. To enable Workbench to delete or update without where clause, uncheck the check box as shown
below. (This has to be done just once. Close and re-launch MySQL WorkBench for the settings to be
"in effect")

Page 10
SMU Classification: Restricted

IS112 Data Management

FREQUENTLY ASKED QUESTIONS


1. I am running a query that is expected to return more than 1000 records. I do not see them!

Go to Edit – Preferences on MySQLWorkBench Menu. In the option SQL Execution under SQL Editor,
check if there is a limit on the number of rows displayed and increase it (see the screen below). Save
setting. Close WorkBench and re-open again. You should be able to see the results.

2. I want to load data using LOAD DATA command. I get the error "1290. The MySQLServer is running
with the –secure-file-priv options…"

MySQL is set with secure-file-priv option that basically limits from which directories one can upload
data. The first step is to find out the directory it is set to.
Run the following command on SQL WorkBench query editor.
show variables like '%secure%'

From the above screenshot it is seen that the directory from which we could upload data is under
"c:\ProgramData\MySQL\MySQL Server 8.0\Uploads\".

Page 11
SMU Classification: Restricted

IS112 Data Management

The folder ProgramData under c:\ is by default hidden. You should make it visible. To do that, go to
Windows Explorer Menu, choose View - Options, you will get a window as shown below. Select the
option "Show hidden files.. " and click "OK" on the pop-up window.

You could now place your data files in the folder set by "secure-file-priv" option and load the data.

3. I have placed my data files in the directory that is set by "secure-file-priv". SQLWorkBench still
throws me the error "1290: The MySQLServer is running with the –secure-file-priv options…"

Assume that the directory secure-file-priv restricts to is "c:\ProgramData\MySQL\MySQL Server


8.0\Uploads\". If you place the data folder with all .txt files in "C:\ProgramData\MySQL\MySQL
Server 8.0\Uploads\data" and assume that we are uploading data from orders.txt into a relation
named T_ORDER

The load data command should be


LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/data/orders.txt' INTO TABLE
order..

Note the "/". Or on Windows it could be "\\"


LOAD DATA INFILE 'C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Uploads\\data\\orders.txt' INTO
TABLE t_order..

Page 12
SMU Classification: Restricted

IS112 Data Management

4. While inserting data into a table, I get the error number "1452: Cannot add or update a child row..".
What is the error?

This error occurs when you are inserting data into a table that has Foreign Key (FK) and the values
from the .txt file that you are uploading with does not have the corresponding column. Some
suggestions to get to the root of the issue:
a. Check the order of the columns of the created table and the .txt file, they should match.
b. Check in the data file (.txt file) if there are any empty rows or empty columns in the end (you
could check with an editor like Notepad++. This could cause problem if the last column is a FK
column and when it is empty, there is no match for it in the Primary table.)
c. Check if the FK column is left empty in one or more rows. Leaving FK column empty does not
indicate to MySQL that null has to be inserted.
d. Check the data (.txt) file to see what delimiters are used. Use appropriate delimiter
clauses "FIELDS TERMINATED BY" and "LINES TERMINATED BY".
e. If the column corresponding to the foreign key is the last column in the .txt file, you may get this
error even though the value corresponding the last column exists in the corresponding primary
table. Use LINES TERMINATED BY '\r\n' or '\n' or '\r' in "LOAD infile" command as appropriate.

Figure: Screenshot of a tab delimited .txt file terminated with "\r\n"

Depending on the OS that is used while creating the .txt file, the terminating character differs.

5. While loading data using .txt file, how do we indicate that a column value is NULL?

You have to place \N in the .txt (Text) file instead of leaving it blank. MySQL "LOAD infile" command
would treat \N as null when loading data into the database table.

6. While loading data using .txt file, can I indicate certain lines to be loaded?

Yes, specify the starting line in "LOAD infile" command as

LOAD DATA INFILE '……/orders.txt' INTO TABLE t_order FIELDS TERMINATED BY


'\t' LINES TERMINATED BY '\r\n' IGNORE 4 LINES;

This inserts the data from line 5 until the last line into the order table. This might be helpful if you
want to append the data when there is an error during previous data loading and you have few lines
of data already loaded.

7. While loading the file that contains date column, I receive the error ‘Error 1292: Incorrect date
value’. How do I handle this?

Page 13
SMU Classification: Restricted

IS112 Data Management

This error is thrown when the table column of data type date does not receive values in the format
yyyy-mm-dd hh:mm:ss
The .txt file from which you are uploading data should have the date (datetime) columns in the
format expected. Another alternative is to use the function str_to_date while loading the data as
explained below.

Suppose you have a table named t_customer that contains two columns cus_id(int), join_date(date)
and the customer.txt file has the date in the format dd/mm/yy you could do the following:

LOAD DATA INFILE '.../customer.txt INTO TABLE t_customer FIELDS TERMINATED BY


'\t' LINES TERMINATED BY '\r\n' (cus_id, @coldate) set join_date = str_to_date(@coldate,
'%d/%m/%y');

The str_to_date() function requires two arguments: the date(or datetime) string that you want to
convert and the format of the date (or datetime) string

for the specifiers to be used in the second argument format, refer to the link
https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_date-format

Page 14
SMU Classification: Restricted

IS112 Data Management

APPENDIX A – MYSQL Workbench Upgrade


1. In the Select Products To Upgrade page, select MySQL Workbench and click "Next"

2. Select the MySQL Workbench and click "Next"

3. Upon upgrade completion you will see the completion page as below

MySQL WorkBench upgrade is complete. You may proceed to page 8 of this document to learn
about the connection of MySQL Server using MySQL WorkBench.

Page 15
SMU Classification: Restricted

IS112 Data Management

APPENDIX B– MYSQL Workbench Installation for MAC OS

1. MySQL Workbench 8.0.27 download. Go to the link https://dev.mysql.com/downloads/workbench/


Choose the option macOS as shown below, and click on "Download Page" for the DMG Archive.

Note this version of MySQL Workbench requires mac OS of version 10.15 or later.

2. Drag the MySQL Workbench icon onto the Applications icon as instructed to install the software.
(you may refer to https://dev.mysql.com/doc/workbench/en/wb-installing-mac.html)

Page 16

You might also like