$ sudo dpkg -i mysql-apt-config0.8.12-1all.deb. Once the installation for the repository has been completed, we will install MySql workbench using the following command, $ sudo apt-get install mysql-workbench. After the execution of above command is complete, we can launch the Mysqlworbench either from menu or from terminal, $ mysql. MySQL Community Edition is a freely downloadable version of the world's most popular open source database that is supported by an active community of open source developers and enthusiasts. MySQL Cluster Community Edition is available as a separate download. The reason for this change is so that MySQL Cluster can provide more frequent updates. The MySQL Yum repository for Oracle Linux, Red Hat Enterprise Linux and CentOS provides RPM packages for installing the MySQL server, client, MySQL Workbench, MySQL Utilities, MySQL Router, MySQL Shell, Connector/ODBC, Connector/Python and so on (not all packages are available for all the distributions; see Installing Additional MySQL Products and Components with Yum for details). MySQL Workbench is a unified visual tool for database architects, developers, and DBAs. MySQL Workbench provides data modeling, SQL development, and comprehensive administration tools for server configuration, user administration, backup, and much more. MySQL Workbench is available on Windows, Linux and Mac OS X. Download Percona Distribution for MySQL The most complete, stable, scalable, and secure, open-source MySQL solution available.
Install MySQL Server on the Ubuntu operating system
Authored by: Jered Heeschen
MySQL is an open-source relational database that is free and widely used. It isa good choice if you know that you need a database but don’t know much aboutall the available options.
This article describes a basic installation of a MySQL database server onthe Ubuntu operating system. You might need to install other packages to letapplications use MySQL, like extensions for PHP. Check your applicationdocumentation for details.
Install MySQL
Install the MySQL server by using the Ubuntu operating system package manager:
The installer installs MySQL and all dependencies.
If the secure installation utility does not launch automatically after theinstallation completes, enter the following command:
This utility prompts you to define the mysql root passwordand other security-related options, including removing remote accessto the root user and setting the root password.
Allow remote access
If you have iptables enabled and want to connect to the MySQL database fromanother machine, you must open a port in your server’s firewall (the defaultport is 3306). You don’t need to do this if the application that uses MySQLis running on the same server.
Run the following command to allow remote access to the mysql server:
Start the MySQL service
After the installation is complete, you can start the database service byrunning the following command. If the service is already started, a messageinforms you that the service is already running:
Launch at reboot
To ensure that the database server launches after a reboot, run the followingcommand:
Configure interfaces
MySQL, by default is no longer bound to ( listening on ) any remotely accessible interfaces.Edit the “bind-address” directive in /etc/mysql/mysql.conf.d/mysqld.cnf:
Restart the mysql service.
Start the mysql shell
There is more than one way to work with a MySQL server, but this articlefocuses on the most basic and compatible approach, the mysql
shell.
Download Mysql 5.5 For Linux
At the command prompt, run the following command to launch the
mysql
shell and enter it as the root user:When you’re prompted for a password, enter the one that you set atinstallation time, or if you haven’t set one, press Enter to submit nopassword.
The following
mysql
shell prompt should appear:
Set the root password
If you logged in by entering a blank password, or if you want to change the rootpassword that you set, you can create or change the password.
For versions earlier than MySQL 5.7, enter the following command in the
mysql
shell, replacepassword
withyour new password:For version MySQL 5.7 and later, enter the following command in the
mysql
shell, replacingpassword
withyour new password:To make the change take effect, reload the stored user information with the following command:
Note: We’re using all-caps for SQL commands. If you type thosecommands in lowercase, they’ll work. By convention, the commands arewritten in all-caps to make them stand out from field names and otherdata that’s being manipulated.
If you need to reset the root password later, see Reset a MySQL root password.
View users
MySQL stores the user information in its own database. The name of the databaseis mysql. Inside that database the user information is in a table, adataset, named user. If you want to see what users are set up in the MySQLuser table, run the following command:
The following list describes the parts of that command:
- SELECT tells MySQL that you are asking for data.
- User, Host, authentication_string tells MySQL what fields you want it tolook in. Fields are categories for the data in a table. In this case, youare looking for the username, the host associated with the username, andthe encrypted password entry.
- FROM mysql.user ' tells MySQL to get the data from the mysqldatabase and the user table.
- A semicolon (;) ends the command.
Note: All SQL queries end in a semicolon. MySQL does not process a queryuntil you type a semicolon.
User hosts
The following example is the output for the preceding query:
Users are associated with a host, specifically, the host from which they connect.The root user in this example is defined for localhost, for the IP addressof localhost, and the hostname of the server.You usually need to set a user for only one host, the one from which youtypically connect.
If you’re running your application on the same computer as the MySQLserver, the host that it connects to by default is localhost. Any newusers that you create must have localhost in their host field.
If your application connects remotely, the host entry that MySQL looks foris the IP address or DNS hostname of the remote computer (the one from whichthe client is coming).
Anonymous users
In the example output, one entry has a host value but no username or password.That’s an anonymous user. When a client connects with no username specified,it’s trying to connect as an anonymous user.
You usually don’t want any anonymous users, but some MySQL installationsinclude one by default. If you see one, you should either delete the user(refer to the username with empty quotes, like ' ‘) or set a password for it.
Create a database
There is a difference between a database server and a database, even thoughthose terms are often used interchangeably. MySQL is a database server, meaning ittracks databases and controls access to them. The database stores the data, andit is the database that applications are trying to access when they interactwith MySQL.
Some applications create a database as part of their setup process, but othersrequire you to create a database yourself and tell theapplication about it.
To create a database, log in to the mysql
shell and run the following command,replacing demodb
with the name of the database that you want to create:
After the database is created, you can verify its creation by running a query tolist all databases. The following example shows the query and example output:
Add a database user
When applications connect to the database using the root user, they usually have more privileges than they need. You can add users that applications can use to connect to the new database. In the following example, a user named demouser is created.
To create a new user, run the following command in the
mysql
shell:When you make changes to the user table in the mysql database, tellMySQL to read the changes by flushing the privileges, as follows:
Verify that the user was created by running a SELECT query again:
Grant database user permissions
Right after you create a new user, it has no privileges. The user can log in,but can’t be used to make any database changes.
Give the user full permissions for your new database by running thefollowing command:
Flush the privileges to make the change official by running the followingcommand:
To verify that those privileges are set, run the following command:
MySQL returns the commands needed to reproduce that user’s permissions ifyou were to rebuild the server.
USAGE on *.*
means the usersgets no privileges on anything by default. That command is overridden by thesecond command, which is the grant you ran for the new database.
Summary
If you’re just creating a database and a user, you are done. The conceptscovered here should give you a solid start from which to learn more.
Related articles
Download Mysql For Linux
©2020 Rackspace US, Inc.
Download Mysql In Linux
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License