[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
howtos:databases:install_mysql_on_slackware [2013/02/11 16:51 (UTC)] – [Configure MySQL] wisedraco | howtos:databases:install_mysql_on_slackware [2013/02/12 11:31 (UTC)] (current) – Layout changes (proper heading/enumeration) and use of correct english in the new UTF8 section. alienbob | ||
---|---|---|---|
Line 1: | Line 1: | ||
<!-- Reviewed 2012-01-05 mfillpot --> | <!-- Reviewed 2012-01-05 mfillpot --> | ||
- | < | + | < |
====== Install MySQL On Slackware ====== | ====== Install MySQL On Slackware ====== | ||
- | ===== Install | + | ===== Installing |
- | Install MySQL from the official Slackware discs or using | + | Install MySQL from the official Slackware discs or using [[slackware: |
- | [[slackware: | + | |
- | ===== Configure | + | ===== Configuring |
- | == 1) Create the needed database(s) and set their permissions properly | + | |
- | As root, run: | + | - Create the needed database(s) and set their permissions properly |
- | < | + | |
root@darkstar# | root@darkstar# | ||
- | </ | + | </ |
- | + | | |
- | User specified by '' | + | |
- | set right user here, otherwise MySQL won't be able to write to database. By | + | |
- | default MySQL in Slackware runs as user " | + | |
- | + | ||
- | == 2) Enable execution of rc script to start MySQL automatically on boot == | + | |
- | //This is optional.// | + | |
- | < | + | |
root@darkstar# | root@darkstar# | ||
</ | </ | ||
- | + | - Enable networking if needed | |
- | == 3) Enable networking if needed | + | |
- | Networking is disabled by default to improve security. If you want to allow | + | |
- | network connections, | + | |
- | <file sh rc.mysqld> | + | |
# | # | ||
</ | </ | ||
- | + | - Start mysqld < | |
- | == 4) Start mysqld | + | |
- | < | + | |
root@darkstar# | root@darkstar# | ||
- | </ | + | </ |
- | < | + | ===== Securing MySQL ===== |
- | Now you have a choice : Manual Install or Automatic | + | |
- | </ | + | |
- | == AUTOMATIC | + | < |
- | == 5) 6) 7) Run the following, answer the questions | + | |
- | < | + | ==== Automatic configuration of secure access |
+ | - Run the following | ||
root@darkstar# | root@darkstar# | ||
- | </ | + | </ |
- | // Initial | + | |
- | == MANUAL | + | ==== Manual configuration of secure access ==== |
- | == 5) Set a password for MySQL' | + | - Set a password for MySQL' |
- | < | + | |
root@darkstar# | root@darkstar# | ||
- | </ | + | </ |
- | + | ||
- | If you enabled networking, you should also run this command: | + | |
- | < | + | |
root@darkstar# | root@darkstar# | ||
</ | </ | ||
- | |||
<note tip> | <note tip> | ||
- | Check the '' | + | Check the '' |
- | copy/paste them. The hostname will already be replaced by yours. | + | |
</ | </ | ||
- | == 6) Connect | + | ===== Connecting |
- | < | + | |
+ | - Connect to your MySQL server using the following command | ||
user@darkstar$ mysql -u root -p | user@darkstar$ mysql -u root -p | ||
</ | </ | ||
- | + | - For security reasons you should delete the anonymous user | |
- | + | | |
- | == 7) For security reasons you should delete the anonymous user == | + | |
- | For the localhost server: | + | |
- | + | ||
- | < | + | |
mysql> use mysql | mysql> use mysql | ||
mysql> SELECT user, host FROM user; | mysql> SELECT user, host FROM user; | ||
mysql> DELETE FROM user WHERE host=' | mysql> DELETE FROM user WHERE host=' | ||
</ | </ | ||
- | + | * If you enabled networking, you should run this command instead: < | |
- | If you enabled networking, you should run this command instead: | + | |
- | < | + | |
mysql> use mysql | mysql> use mysql | ||
mysql> SELECT user, host FROM user; | mysql> SELECT user, host FROM user; | ||
Line 86: | Line 58: | ||
</ | </ | ||
- | == Finish set configfile | + | ==== Adding Unicode support |
- | | + | |
- | | + | |
- | < | + | |
[mysqld] | [mysqld] | ||
collation-server = utf8_unicode_ci | collation-server = utf8_unicode_ci | ||
init-connect=' | init-connect=' | ||
character-set-server = utf8 | character-set-server = utf8 | ||
- | </ | + | </ |
- | This gives you full utf8 on your mysql server, after restart | + | |
- | More on this described | + | More on Unicode / UTF8 character set support is described |
===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
- | | + | |
- | < | + | |
root@darkstar# | root@darkstar# | ||
</ | </ | ||
- | * Resetting the root password can be done by creating a new cnf file and add the following lines (please change the password in this example): | + | * Resetting the root password can be done by creating a new cnf file and add the following lines (please change the password in this example): <file sql mysql_new.cnf> |
- | <file sql mysql_new.cnf> | + | |
UPDATE mysql.user SET Password=PASSWORD(' | UPDATE mysql.user SET Password=PASSWORD(' | ||
FLUSH PRIVILEGES; | FLUSH PRIVILEGES; | ||
- | </ | + | </ |
- | + | ||
- | Save this file (any name would do) and start the server with the --init-file | + | |
- | argument: | + | |
- | < | + | |
root@darkstar# | root@darkstar# | ||
</ | </ | ||
Line 125: | Line 92: | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
- | <!-- You must remove the tag-word " | ||
{{tag> | {{tag> | ||
- |