Differences between revisions 68 and 69
Revision 68 as of 2018-01-12 12:11:20
Size: 3869
Editor: ?RobieBasak
Comment:
Revision 69 as of 2018-02-10 20:17:45
Size: 4364
Editor: ?SergiyKolesnikov
Comment: Add section about Root Access and Adding Users
Deletions are marked like this. Additions are marked like this.
Line 40: Line 40:
You can also use MySql Navigator (GUI client program for MySql database server) by typing
{{{
  mysql-navigator
}}}

in a terminal (the package name is the same to get it using apt or [[Synaptic]]).

or mysql-query-browser (official GUI tool to query MySql database).

After installation, you can find it in the Debian / Database menu too.

You can also use MySql Control Center, gmyclient and gnome-database .
You can also use DebPkg:emma and DebPkg:gmysqlcc GUI clients to access and administrate MySQL databases.
Line 55: Line 44:
== Root Access and Adding Users ==

At least since Debian 9 "stretch," operating system credentials are used by MySQL Server to authenticate users. That is, after installing DebPkg:mysql-server and DebPkg:mysql-client you can access the server with root privileges by executing the following

{{{
su
mysql
}}}

or

{{{
sudo mysql
}}}

Note: Your user must be in the `sudo` group for this to work.

To allow your user to access the MySQL server, run the MySQL client as root:

{{{
su
mysql
}}}

In the client, execute the following (replace `YOUR_SYSTEM_USER` with your user name):

{{{
USE mysql;
CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED VIA unix_socket;
exit;
}}}

Now you can access the server simply by running

{{{
mysql
}}}
 
Line 56: Line 83:
=== Reseting the Root Password === === Reseting the Root Password for Debian 8 "jessie" and older ===

Translation(s): Deutsch - English - Français -Русский

(!) ?Discussion


MySQL is a relational Database Management System.

Install

Install the packages mysql-server and mysql-client (which depends on the current "best" version of mysql).

MySql Server

MySql will start on boot time. You can also type manually (as root):

  /etc/init.d/mysql start

After an upgrade of the Debian package you might need to run (as root):

  mysql_fix_privilege_tables.

MySql will only install if you have a NON-NUMERIC hostname that is resolvable via the /etc/host file

  • The Debian package of MySql server creates the user debian-sys-maint that is used in the start-stop and cron scripts. Don't delete it.

MySql Client

To use MySql client just type as any user :

  mysql

MySQL Workbench is also a great GUI tool for managing local and remote databases. This is the "official" GUI of the MySQL project and can be installed from the main repository by running the following command in a terminal:

   apt-get install mysql-workbench 

You can also use emma and gmysqlcc GUI clients to access and administrate MySQL databases.

If you have Apache and PHP installed, you can use phpMyAdmin to administer any MySql databases.

Root Access and Adding Users

At least since Debian 9 "stretch," operating system credentials are used by MySQL Server to authenticate users. That is, after installing mysql-server and mysql-client you can access the server with root privileges by executing the following

su
mysql

or

sudo mysql

Note: Your user must be in the sudo group for this to work.

To allow your user to access the MySQL server, run the MySQL client as root:

su
mysql

In the client, execute the following (replace YOUR_SYSTEM_USER with your user name):

USE mysql;
CREATE USER 'YOUR_SYSTEM_USER'@'localhost' IDENTIFIED VIA unix_socket;
exit;

Now you can access the server simply by running

mysql

Troubleshooting

Reseting the Root Password for Debian 8 "jessie" and older

During the installation of MySQL Server you were prompted to set the password for the root user for the database. If you forget this password or if there are some issues during the installation you can reset the root password using the steps below.

1. Login to a terminal with the root user

2. Stop MySQL

   service mysql stop 

3. Create a file called mysql-init

   nano mysql-init 

4. Paste the following contents into the mysql-init file, make sure to change the password to the new password of your choice. Save this file and exit nano.

   UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

5. Start MySQL using the following command

   mysqld_safe --init-file=mysql-init &

6. Remove the mysql-init file

   rm mysql-init 

7. Start MySQL normally and you should now be able to login with the root database user using the new password that you just created.

   service mysql start 

Debian Development

Ubuntu Development

Some pointers for merging Debian branches into Ubuntu can be found on the Ubuntu Development page.