Years ago I needed MySQL on my Ubuntu box, I wasn’t interested in MySQL, just in a package that needed it. I didn’t pay any attention to the database, just selected it in the package manager, answered a couple of questions and IT ALL JUST WORKED.
Yesterday I started to go through the same process on my newly resuscitated OpenSolaris box, selected “mysql” in the package manager and selected “Install”. It downloaded, it said it was installing, the installer finished and I tried to go on with what I was interested in. In the immortal words of Catweazle, “NUTHINK WORKS!”
MySQL server not available
Sure enough, nothing seems to be running, nothing seems to be configured, there’s no instructions and I guess I’m just meant to hunt around and find out how to do it myself.
Output of mysql_install_db
Hunting around the only real reference I can find on MySQL on OpenSolaris – 2.6.2. Installing MySQL on OpenSolaris using IPS – seems to imply that I need to run mysql_install_db myself, so I do. Below is its output, interleaved with my comments or later investigations:
me@hosty:/usr/mysql$ pfexec bin/mysql_install_db WARNING: The host 'hosty' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... 110718 21:56:34 [Warning] Forcing shutdown of 2 plugins OK Filling help tables... 110718 21:56:35 [Warning] Forcing shutdown of 2 plugins OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
As far as I can tell there is nothing called “support-files” anywhere, the only “mysql.server” file is at
So where is “the right place” for this system? RTFM? Maybe, but which FM?
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:
Any suggestions on how to “start the server” or am I just meant to know how?
/usr/mysql/5.1/bin/mysqladmin -u root password 'new-password' /usr/mysql/5.1/bin/mysqladmin -u root -h hosty password 'new-password' Alternatively you can run: /usr/mysql/5.1/bin/mysql_secure_installation
None of which work, because the server isn’t running or won’t run.
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. See the manual for more instructions.
What manual? I can’t seem to find any manual:
me@hosty:/usr/mysql/5.1$ man mysql No manual entry for mysql.
Back to the output, seems I finally get instructions on how to run the daemon:
You can start the MySQL daemon with: cd /usr/mysql/5.1 ; /usr/mysql/5.1/bin/mysqld_safe &
I can, but it promptly exits.
me@hosty:/usr/mysql/5.1# /usr/mysql/5.1/bin/mysqld_safe 110719 12:32:10 mysqld_safe Logging to '/var/mysql/5.1/data/hosty.err'. 110719 12:32:10 mysqld_safe Starting mysqld daemon with databases from /var/mysql/5.1/data 110719 12:32:11 mysqld_safe mysqld from pid file /var/mysql/5.1/data/hosty.pid ended You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql/5.1/mysql-test ; perl mysql-test-run.pl
No I can’t, the script doesn’t exist.
bash: cd: /usr/mysql/5.1/mysql-test: No such file or directory Can't open perl script "mysql-test-run.pl": No such file or directory Please report any problems with the /usr/mysql/5.1/bin/mysqlbug script!
I’d love to, but I really don’t know where to start, and knowing my luck so far the bug reporting script will fail because the server isn’t running!
Nothing seems to be running and the service is put into “maintenance”
me@hosty:/usr/mysql/5.1$ svcs mysql STATE STIME FMRI maintenance 22:14:42 svc:/application/database/mysql:version_51
Error messages hosty.err
The error file
/var/mysql/5.1/data/hosty.err says that files that do exist don’t, and that I should run a utility that cannot be run:
110719 12:47:39 mysqld_safe Starting mysqld daemon with databases from /var/mysql/5.1/data 110719 12:47:39 [Note] Plugin 'FEDERATED' is disabled. /usr/mysql/5.1/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
Can’t find it? I can.
me@hosty:/var/mysql/5.1/data# ls -l mysql/plugin.frm -rw-rw---- 1 root root 8586 Jul 18 22:22 mysql/plugin.frm
Is the message spurious, or are the permissions or ownership wrong?
110719 12:47:39 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
I’d love to run mysql_upgrade, but I can’t, since it requires the server to be running in order to update the database.
InnoDB: Log scan progressed past the checkpoint lsn 0 37356 110719 12:47:40 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 0 44233 110719 12:47:40 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 110719 12:47:40 InnoDB: Started; log sequence number 0 44233 110719 12:47:40 [ERROR] /usr/mysql/5.1/bin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
Still can’t find it. Its still there:
me@hosty:/var/mysql/5.1/data# ls -l ./mysql/host.frm -rw-rw---- 1 root root 9510 Jul 18 22:22 ./mysql/host.frm
Is the message spurious, or are the permissions or ownership wrong?
110719 12:47:40 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13) 110719 12:47:40 mysqld_safe mysqld from pid file /var/mysql/5.1/data/hosty.pid ended
A couple of hours of searching and reading has left me none the wiser; MySQL seems to be all there, but apparently won’t run because it isn’t configured, and can’t be configured because it isn’t running.
: I believe I’ve fixed it. Knowing two-fifths of stuff-all about OpenSolaris meant I was at a loss of where to look, the only message that seemed in any way meaningful was about the “missing files” that I could see were in
/var/mysql/data/mysqlcouldn’t be read. Everything else under
/var/mysql/datawas owned mysql:mysql, but that directory was root:root. Changing the ownership:
chown -R mysql.mysql mysql
Let me manually run the mysql daemon:
cd /usr/mysql/5.1 ; /usr/mysql/5.1/bin/mysqld_safe
Clearing the service “maintenance” flag and then restarting the service had it all running (I think).
svcadm clear mysql
So I’m still not sure if it was me or the OpenSolaris/OpenIndiana mysql package, but I think I’ve got it working.