- Install mysql
- Configure mysql server user
- Install mysql-workbench
sudo apt-get update
sudo apt-get install mysql-server
mysql --version OR mysql -V
# mysql Ver 8.0.36-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
sudo systemctl status mysql
By default, auth_socket
plugin enabled for root user, with this you can directly connect to mysql server using 👇
sudo mysql
# This will let you connect to mysql server
Check the user table to verify the authentication_string and plugin for root user -
SELECT user,authentication_string,plugin,host FROM mysql.user WHERE user="root";
Notice plugin is set to auth_socket, which enabes you to login to the MySQL server as root user with your sudo password.
In order to login using password, you need to update the plugin column value for root user.
You can change it to caching_sha2_password
to login with password
Login with sudo mysql and update the plugin column
sudo mysql
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'PROVIDE_YOUR_PASSWORD_HERE';
# once updated, clear the privileges to reload user
mysql> FLUSH PRIVILEGES;
Now you can connect to mysql db with user and password 👇
mysql -u root -p
Enter password: xxxxxxxx
# This will now let you login to sql server
This is a graphical user interface used to connect to mysql server.
Download mysql-workbench from 👉 https://dev.mysql.com/downloads/workbench/.
Say you download mysql-workbench-community_8.0.36-1ubuntu22.04_amd64.deb
#Install it using dpkg
sudo dpkg -i mysql-workbench-community_8.0.36-1ubuntu22.04_amd64.deb
In case if you get any dependency errors, run these commands to fix the installation
sudo apt-get install gnome-menus
# choose Yes when asked for confirmation
sudo apt --fix-broken install
Verify mysql-workbench version
mysql-workbench --version
# Found /lib/x86_64-linux-gnu/libproj.so.22
# MySQL Workbench CE (GPL) 8.0.36 CE build 3737333
Launch the workbench with 👇
mysql-workbench
# This should open the mysql workbench graphical user interface