Difference between revisions of "Package:Mysql-community"

From Funtoo
Jump to navigation Jump to search
(Created page with "{{Ebuild |Summary=MySQL is a fast, multi-threaded, multi-user SQL database server. |CatPkg=dev-db/mysql-community |Maintainer= |Homepage=http://www.mysql.com/ }} {{Note|mysql-...")
Line 26: Line 26:
{{console|body=###i## rc-update add mysql default}}
{{console|body=###i## rc-update add mysql default}}

==== Secure instalation ====
==== Secure installation ====
Now, run {{c|mysql_secure_installation}}. You will be promted for setting your password, as well as other required steps.
Now, run {{c|mysql_secure_installation}}. You will be promted for setting your password, as well as other required steps.
{{console|body=###i## mysql_secure_installation}}
{{console|body=###i## mysql_secure_installation}}

Revision as of 13:29, January 27, 2019



We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


mysql-community is what known as MySQL, version 8. The name mysql-community is just a distinct ebuild name to point a significant changes compared to version 5.x and that mysql-community is an open source version, not enterprise commercial software.

MySQL is the M in the lamp/lemp/llmp stack. It is a popular, & common database that accepts SQL statements. dev-db/mariadb & No results are drop in replacements for MySQL.


root # emerge mysql-community

First Run

MySQL requires configuration upon instillation.

To deploy MySQL:

root # mysqld --initialize-insecure --default_authentication_plugin=mysql_native_password

This will create MySQL base directory, by default /var/lib/mysql as well as an empty password for your initial database setup. This is preliminary step before setting up your password, see below


To start mysql:

root # rc-service mysql start

To start upon boot:

root # rc-update add mysql default

Secure installation

Now, run mysql_secure_installation. You will be promted for setting your password, as well as other required steps.

root # mysql_secure_installation


To use mysql you will need to run MySQL as the funtoo root user, logging in as the mysql database root user. The system root user is not the same as the database root user, and passwords for both should be different.

root # mysql -u root -p
Enter password: 

mysql is now blinking at you ready for SQL statements.

Root use is discouraged, for every database you require, create a user, and a database specific for the application, then allow the user access with as stripped down as possible permissions. We will use phpBB examples of creating a phpBB user & database.

root # mysql -u root -p
Enter password: 
mysql> CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'changeme';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `phpbb`.* TO 'phpbb'@'localhost' IDENTIFIED BY 'changeme';
mysql> \q


By default MySQL logs every action, including leaving plain text passwords in its history file.

To remove the history file:

root # rm /root/.mysql_history

To automatically remove future history:

root # ln -s /dev/null /root/.mysql_history