[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 876
  • Last Modified:

Problem configuring mysql on Slackware/Linux

I'm trying to set up MySQL for the first time on a new Slackware 14.1 host. Per the init script, I first ran:

mysql_install_db --user=mysql

That appeared to work. The output from that command stated, in part:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h mail password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

Open in new window

I have no idea what lines 1 and 2 are asking me to do (right place for my system?), so I skipped that -- perhaps that's the source of my problem.

I did start the server per line 5 (/etc/rc.d/rc.mysql start); that worked. Then set the root password per line 7; that worked. But when I tried to set the password per line 8 I got the error:
/usr/bin/mysqladmin: connect to server at 'mail' failed
error: 'Can't connect to MySQL server on 'mail' (111)'
Check that mysqld is running on mail and that the port is 3306.
You can check this by doing 'telnet mail 3306'

Open in new window

Telneting to mail 3306 gives me:
$ telnet mail 3306
Trying 192.168.0.2...
telnet: connect to address 192.168.0.2: Connection refused

Open in new window

`netstat -tlpn` shows no processes named mysqld or mysqld_safe, or such-like and nothing on 3306.

ps axww gives:
29280 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid --skip-networking
29384 pts/0    Sl     0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-networking --log-error=/var/lib/mysql/mail.err --pid-file=/var/run/mysql/mysql.pid

Open in new window

Here's the output in /var/lib/MySQL/mail.err
140818 07:10:37 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140818  7:10:37 InnoDB: The InnoDB memory heap is disabled
140818  7:10:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140818  7:10:37 InnoDB: Compressed tables use zlib 1.2.6
140818  7:10:37 InnoDB: Using Linux native AIO
140818  7:10:37 InnoDB: Initializing buffer pool, size = 128.0M
140818  7:10:37 InnoDB: Completed initialization of buffer pool
140818  7:10:37 InnoDB: highest supported file format is Barracuda.
140818  7:10:37  InnoDB: Waiting for the background threads to start
140818  7:10:38 Percona XtraDB (http://www.percona.com) 5.5.32-MariaDB-30.2 started; log sequence number 1597945
140818  7:10:38 [Note] Plugin 'FEEDBACK' is disabled.
140818  7:10:38 [Note] Event Scheduler: Loaded 0 events
140818  7:10:38 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.32-MariaDB'  socket: '/var/run/mysql/mysql.sock'  port: 0  MariaDB Server

Open in new window

I'm stumped. Need help!
0
jmarkfoley
Asked:
jmarkfoley
  • 5
  • 5
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
I never did get mysql running on Slackware 10.0.  But Slackware 14.1 is supposed to have taken care of some of those configuration problems.  This page http://www.neiland.net/blog/article/configuring-mariadb-on-slackware-14-1/ and this page http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html may help.  The default 'bind-address' is supposed to be 0.0.0.0 to allow connections from anywhere.
0
 
jmarkfoleyAuthor Commented:
Dave Baldwin: I followed the instructions in your link  http://www.neiland.net/blog/article/configuring-mariadb-on-slackware-14-1/. The only different suggestion it has was to

chown -R mysql.mysql /var/lib/MySQL

Though not all files in that folder were owned by mysql.mysql, it didn't seem to make much difference (although, I found lots of useful information on that site, so thanks!). I still get the same error as in my initial posting when I run

'/usr/bin/mysqladmin' -u root -h mail password 'new-password'

So, before I move on trying to solve this, maybe I don't have a problem after all. The command that worked and the command that didn't differ only by the option '-h hostname'. The output of  mysql_install_db says:
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h mail password 'new-password'

Open in new window

Although this commentary say nothing about why I am supposed to run this command twice, once without and once with the -h option, maybe it doesn't mean that  literally. Perhaps the -h option is for accessing the server remotely. And, as your 2nd link says, "By default remote access to the MySQL database server is disabled for security reasons."

So, since I don't really care about remote access, do you think I could simply ignore the `mysqladmin -h` bit?
0
 
Dave BaldwinFixer of ProblemsCommented:
Maybe.  Can you login to the mysql command line program in the terminal?

mysql -uroot -ppassword
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
jmarkfoleyAuthor Commented:
I believe I can (not real familiar with MySQL). Here's what I get when I try:
$ mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.32-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Open in new window

Note that I have to give it an empty -p parameter or, if I leave off the -p I get:
$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Open in new window

Your suggested syntax works too, if there is no space between the -p and the password.

Do you think this looks OK?
0
 
Dave BaldwinFixer of ProblemsCommented:
Looks fine and normal, it's basically working.  And yes, no space between '-p' and the password.  Now you need to setup the rest of the things you want like other users and databases.
0
 
jmarkfoleyAuthor Commented:
> Now you need to setup the rest of the things you want like other users and databases.

I'm actually setting this up as part of the instructions for configuring OpenChange so I'm sure there will be some setup for users/databases for that. At the moment, I have no need outside of OpenChange for mysql. This is why I want to make sure I have everything set correctly before moving on with OpenChange setup. I'd really *hate* to have to back things out.

Next hopefully minor issue ... as I mention in my initial post, the mysql_install_db output said
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

Open in new window

I've researched a bit on this and can find no references to where the "right place" for my system might be. On my system, the file mysql.server is located in /usr/share/mysql/mysql.server, and that's the *only* instance I find. It's dated August 16, 2013, well before I installed this Linux this month.

I am concluding, therefore, that this file was install in /usr/share/mysql as part of the initial distribution DVD and it is already in the "right place" and I need do nothing further with this. Do you agree?
0
 
jmarkfoleyAuthor Commented:
more info: (probably ignore my previous posting ...)

The file /usr/share/mysql/mysql.server is an init script and its comments advise moving this to /etc/init.d al la Debian and other "SYSV R4 based systems".

Since I have /etc/rc.d/rc.mysqld and since I did use that script to start mysql, I suppose I don't need mysql.server at all. The referenced /etc/my.cnf and /etc/my.cnf.d both exist and, I assume are the default locations for configuration info for mysql.

So, I think I don't have to worry about this mysql.server file at all, right?
0
 
Dave BaldwinFixer of ProblemsCommented:
No, it sounds like you're doing fine as it is.  For OpenChange, you have a lot more work to do.
0
 
jmarkfoleyAuthor Commented:
OK, thanks -- it's been a lot of work so far. I'm kind of hoping I'm in the home stretch, but don't say anything if I'm wrong!

The output of mysql_install_db says:
Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

Open in new window

Since it says, "Alternatively ..." the implication is that it is an *alternative* to ... mysql_install_db, but the message displays *after* running mysql_install_db and after the instructions on using mysqladmin to set the password. Confusing. I had tried to run it before mysql_install_db and got the errors,
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
Enter current password for root (enter for none):

Open in new window

I just now ran it after my successful mysql_install_db and it appeared to run fine and remove the anonymous logon and test database, as advertised.

In the end, there is only a couple of dozen or so lines of howto needed and a very few commands that have to be run. It is surprising for Slackware that the brief documentation is so confusing.

To summarize the points of confusion (and the precipitant reason for this email):

They should omit the comment about "copy support-files/mysql.server to the right place for your system", or better document that as being the init script for Debian-like systems. Since this is slackware, maybe they should get rid of the comment altogether.

They should eliminate the instruction to run `/usr/bin/mysqladmin -u root -h mail password 'new-password'`. That simply is not going to run unless remote access is enabled, which it is not by default. Instead, they should reference some other doc for optional remote access configuration. This one spurrious instruction has caused me days of grief trying to track it down.

Finally, instead saying "Alternatively" with respect to the mysql_secure_installation, they should have said something like, "For production environments it is recommended that you next run ..."

These simple documentation changes would have gotten me set up in 10 minutes, not a week later!
0
 
Dave BaldwinFixer of ProblemsCommented:
Yes but... there are so many different installs for MySQL and MariaDB with slightly different instructions for each one.  A lot of distributions have made the install almost completely automatic.  Like I said, I never did get all the way thru installing MySQL on Slackware 10.

Glad you got it working and thanks for the points.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now