Install Mysql and mysql-workbench [apt]

To install latest MySQL to Ubuntu perform the following steps:

Download and add the MySQL repositories

Download the repositories from the official download page manually. Install them.

Update the repository data
sudo apt update
Install MySQL server via apt.

Install MySQL server with the command below. Also, take into consideration the following notes:

  1. During installation you will be asked for a password. Do not leave it blank. For a development computer an easy password like “root” is good enough.
  2. You will be asked to choose the default authentication plugin. For a development computer choose: Legacy authentication.
sudo apt install mysql-server
Install MySQL workbench via APT:

Install MySQL workbench with the command below. After installation, open MySQL workbench and verify that you can connect to the server.

sudo apt install mysql-workbench-community
Install MySQL workbench via SNAP

You can install workbench via SNAP:

sudo snap install mysql-workbench-community

However SNAP packages are sandboxed so workbench will not be able to connect to MySQL. To allow connection use:

sudo snap connect mysql-workbench-community:password-manager-service :password-manager-service
Run security installer (optional)

For improved security you should run the MySQL Security installer. You do not have to run the installer on a development computer:

sudo mysql_secure_installation
Create a user account (optional)

Create a user account for your application:

Connect to MySQL from terminal:

sudo mysql -u root -p

Create the user account:

CREATE USER 'bob'@'localhost' IDENTIFIED BY 'bobpasswd';

Grant privileges for that user:

GRANT ALL PRIVILEGES ON * . * TO 'bob'@'localhost';

You can generate a strong password with an online application like passwords-generator.org

Troubleshooting

If you have problems connecting to the server check the following articles:

References:

1 Comment

Leave a Reply