How To Install MySQL On Ubuntu

MySQL server is a a very popular relational database server in the world. It is used widely in server side. Ubuntu is also the most popular Linux OS in the world. This article will tell you how to install MySQL server in Ubuntu and install MySQL workbench to access the MySQL server.

1. Install MySQL Server On Ubuntu.

Open a terminal in ubuntu and run below command to install MySQL server and client command-line software.

  1. Update ubuntu installation package index.
    $ sudo apt-get update
  2. Install MySQL server.
    $ sudo apt-get install mysql-server
  3. Install MySQL client command-line software.
    $ sudo apt-get install mysql-client
  4. Verify MySQL server is installed and started successfully.
    $ ps -ef|grep mysqld
    mysql 6473 1 0 15:56 ? 00:00:01 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
  5. Verify MySQL server is listening and running.
    $ sudo netstat -tap|grep mysql
    tcp 0 0 localhost:mysql 0.0.0.0:* LISTEN 963/mysqld

2. Install MySQL Workbench.

MySQL workbench is a free client software to manage MySQL server. You can download it from MySQL official website or you can install it directly in Ubuntu software store.

2.1 Install MySQL Workbench With Download File.

  1. Double click the download file.
  2. Click Install button in the open dialog until installation success.

2.2 Install MySQL Workbench In Ubuntu Software Store.

  1. Click Ubuntu Software icon in left navigation bar.
  2. Click search button and input keyword MySQL Workbench in the search box. Then click the icon in the bottom list to install it.
    install mysql workbench in ubuntu

2.3 Fix Can Not Download Through Local Proxy Error.

Which ever method you choose, you may encounter an error when install it, the error message is something like ‘Can not download required software through local proxy server.’. This is because your Ubuntu OS use a global proxy configuration. You should disable the configuration as following.

  1. Click Show Applications icon at bottom left corner.
    ubuntu show applications icon
  2. Then click Settings icon in the applications list to open Ubuntu global settings panel.
  3. Click Network menu item in left then click Network Proxy in right panel to disable it. Then the error will be fixed.
    disable ubuntu global network proxy settings
READ :   How To Get Database Meta Data

3. Connect MySQL Server With MySQL Workbench.

After you install MySQL workbench successfully, you can open it and connect to your MySQL server by click the local instance icon.

connect mysql server with workbench

But for the first time, it will prompt error messages like¬†ERROR 1698 (28000): Access denied for user ‘root’@’localhost’, to fix this error, you need follow below steps.

  1. Open terminal in Ubuntu, input below command to open MySQL client
    ~$ sudo mysql -u root -p
  2. Then execute below sql command in mysql console to change user ‘root’@’localhost’ password to a new one.
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
    Query OK, 0 rows affected (0.01 sec)
    mysql> exit
  3. Now you can use MySQL workbench to connect to the local installed MySQL server successfully and manage database. If you want to learn more about how to use MySQL Workbench, please read article How To Use MySql On Mac РManage MySQL Database With MySQL Workbench section.
(Visited 31 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.