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

Week 1- Installation

The document provides a guide for installing MySQL Workbench, detailing two types of installations: Full Server and Only Client, with a focus on the client setup. It includes step-by-step instructions for downloading, installing, and connecting to a MySQL server, as well as creating a user and granting privileges. Key commands and syntax for user creation and privilege management in MySQL are also outlined.

Uploaded by

AMB 19 SAMYUKTHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Week 1- Installation

The document provides a guide for installing MySQL Workbench, detailing two types of installations: Full Server and Only Client, with a focus on the client setup. It includes step-by-step instructions for downloading, installing, and connecting to a MySQL server, as well as creating a user and granting privileges. Key commands and syntax for user creation and privilege management in MySQL are also outlined.

Uploaded by

AMB 19 SAMYUKTHA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Week 1- Installation

Types of installation
There are two types of installation
1. Full Server : Client and Server are on same machine. The client gets connected to
server addressing it as “localhost”
2. Only client : It is a typical setup used in production where the server would be
remotely hosted and a client gets connected to it.
The remote server ip of <collegename> is
In our series we would be using only CLIENT.

Client Installation:
Here are step-by-step instructions to download and install MySQL Workbench, a popular
MySQL client:

1. Go to the MySQL Website:


Open your web browser and navigate to the MySQL website: [MySQL
Downloads](https://dev.mysql.com/downloads/).

2. Select MySQL Workbench:


On the downloads page, you'll see various MySQL products available for download. Look
for "MySQL Workbench" under the "MySQL Workbench" section. Click on the "Download"
button next to it.

3. Choose Operating System:


After clicking the download button, you'll be taken to a page where you need to select your
operating system. Choose the appropriate option for your system (Windows, macOS, or
Linux) and click on the download button.

4. Install MySQL Workbench:


Once the download is finished, locate the downloaded installer file on your computer
(usually in your Downloads folder) and double-click on it to start the installation process.
Follow the prompts in the installation wizard to install MySQL Workbench on your system.

5. Launch MySQL Workbench:


After the installation is complete, you can launch MySQL Workbench from your desktop or
from the Start menu (on Windows) or the Applications folder (on macOS).
6. Connect to MySQL Server:
When you open MySQL Workbench, you'll be prompted to set up a connection to your
MySQL server. Enter the necessary connection details, such as the hostname, port,
username, and password
NOTE : Hostname = server IP address Port : 3306
Username = root Password = root and then click "OK" to connect.
Another way is as follows :
If you want to connect to MySQL server using the MySQL command-line client from
Command Prompt on Windows, here are the steps:

1. Open Command Prompt:


Press the `Windows` key, type "cmd", and press `Enter` to open Command Prompt.

2. Navigate to MySQL Bin Directory (Optional):


If the MySQL bin directory is not in your system's PATH environment variable, you'll need
to navigate to it in Command Prompt. By default, the MySQL bin directory is located within
the MySQL installation directory, usually something like `C:\Program Files\MySQL\MySQL
Server X.X\bin`. Use the `cd` command to change directory to the MySQL bin directory. For
example:

cd "C:\Program Files\MySQL\MySQL Server X.X\bin"

Replace `"C:\Program Files\MySQL\MySQL Server X.X\bin"` with the actual path to your
MySQL bin directory.

3. Connect to MySQL Server:


Once you're in the MySQL bin directory (or if it's already in your system's PATH), you can
connect to the MySQL server using the following command:

mysql -u username -p -h hostname

Replace `username` with your MySQL username, `hostname` with the hostname or IP
address of the MySQL server, and `-p` will prompt you for the password. If the MySQL
server is running on the same machine, you can use `localhost` for the hostname.

For example, if your username is `root` and you want to connect to a MySQL server
running on localhost, you would use:

mysql -u root -p -h <IP address of Server>

4. Enter Password:
After running the command, you'll be prompted to enter your MySQL password. Type your
password and press `Enter`.

5. Connected to MySQL:
If the credentials are correct, you'll be connected to the MySQL server, and you'll see a
MySQL prompt (`mysql>`), indicating that you're now interacting with the MySQL server.
Create a user
To create a user in MySQL, you can use the CREATE USER statement along with the
desired options to specify the username, password, and host from which the user is allowed
to connect.
Syntax: CREATE USER 'username'@'host' IDENTIFIED BY 'password';

Here,
username: Specify the desired username for the new user.
Host : Define the hostname or IP address from which the user can connect. Use 'localhost'
for connections from the local machine or '%' for connections from any host.
password: Set the password for the new user.

Example 1: Creating a User for Localhost


To create a user name myuser with password mypassword who can connect only from the
local machine (localhost):
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

Granting Privileges to the User


After creating the user, we need to grant specific privileges to the user to perform operations
on databases and tables. Use the GRANT statement to assign privileges:

Syntax: GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'host';

This grants all privileges on all databases (*.*) to 'newuser' when connecting from
'localhost'. Be cautious when granting privileges and only grant the necessary privileges to
the user.

Flush Privileges

After creating the user and granting privileges, we need to flush the privileges to ensure that

they take effect

Syntax: FLUSH PRIVILEGES;

Exit

Once you've created the user and granted privileges, you can exit the MySQL client:

Syntax: EXIT;

You might also like