I realize that the script is using the same credentials regardless of
who is running it, so the issue must be external to mysql. Found it
- /var/db/msql
was 755, the fix was merely:
chmod 755 /var/db/mysql
[2024013]
Today brought in db file from other system.
mysql -u root -p <
[db backup file]
Note that this changed the root password to the one from the old system.
No matter what I tried to do, I got error: ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
A bunch of googling found a bunch of answers, but this was what worked for me:
service mysql-server stop
/usr/local/libexec/mysqld --upgrade=FORCE
Wait for it to say something about "ready", then from another window:
ps axw | grep sql
kill
[pid from prev cmd]
service mysql-server start
pkg install mysql81-server
(this automatically installs client as well)/usr/local/etc/mysql/my.cnf
fixing the 'socket' settings (see below)service mysql-server start
mysql_secure_installation
BTW: the logfile is at: /var/db/mysql/
[your full system
name].err
Once you do have the server running, do
a ps axww | grep sql
and you'll see a bunch of this stuff
called out on the server's command line.
The above is what is supposed to happen. The server would
not start with "failed precmd
". Googled and found:
cd /var/db/
rm mysql/*
rm mysql_secure/*
rm mysql_tmpdir/*
/usr/local/libexec/mysqld --user=mysql --initialize
This gave me an error "unable to create temporary file in mysql_tmpdir".
chmod 777 mysql_tmpdir
Do above initialize again, and it seems to work. Now start server, starts up Ok.
mysql_secure_initialization
will not allow me in no matter what password (including just hitting
enter) is supplied for 'root'. Googling, I happened to encounter how
to fix a minor annoyance in the log, namely Insecure
configuration for --secure-file-priv: Location is accessible to all OS
users. Consider choosing a different directory.
Fixed this by looking in /usr/local/etc/mysql/my.cnf
and
finding where the "--secure-file-priv" line points to and changing
privs:
chmod 750 /var/db/mysql_secure
Restart server, log is now clean, but still cannot get in - always
rejects root password. More googling:
service mysql-server stop
mysqld_safe --skip-grant-tables
In another window:
mysql_secure_installation
Looks like it's working, it asks for new password, but nope, I get
blown off with "you can't do that as we're running skip-grant-tables".
Fuck. Fuck. Fuck. All I'm trying to do is a brand new clean install
of the current software product and I've wasted a whole fucking
morning on it. Why can't this shit just work? Fuck.
mysqladmin shutdown
More googling, found and performed the following:
service mysql-server stop
cd /var/db
rm -rf mysql
service mysql-server start
mysql_secure_installation
This time, it's letting me in. Fucking bullshit.
PHP Warning: mysqli_connect(): (HY000/2002): No such file or
directory in
/dsk2/web/perennialvintners.com/html/weatherstation/pmi.php on line
264
$gDBLink = mysqli_connect("localhost", "
[user]", "
[pswd]", "
[dbname]");
Anyways, turned out mysql server was not running. When I tried to
start it, in the log
at /var/db/mysql/
[hostname].err
, I would get:
2023-01-16T19:10:10.789733Z 0 [ERROR] I/O error reading the header from the binary log
2023-01-16T19:10:10.789748Z 0 [ERROR] Can't init tc log
2023-01-16T19:10:10.789759Z 0 [ERROR] Aborting
With some googling, I found that I could simply clobber
the mysql-bin.*
files from the /var/db/mysql
directory. This scared the crap out of me, as the data in mysql is
precious. I renamed each of those files to ".bak", then did
a service mysql-server start
. The daemon did start
correctly, and my data appears to be intact, thank god!
Some of the pages that I found, discussed changing the configuration to not make these files at all, and discussed how to use the "purge" command to clean them up - of course this latter can't be done until the daemon is running again so I was unable to use this to fix the problem. I also didn't want to make any config changes as I used to have a running system. Now that I'm back up and running, I will try to get back to these issues in the future, but of course at this writing I don't have the time, I used it all up firefighting getting things running at all again!
Start rant: What a fucking ridiculous error message! "No such file".
I know, it is an accurate message, it is saying that the socket file
is indeed not present, but how are we supposed to know that without
context? This is my biggest beef by far with most all computer
software, and that is poor or misleading error messages. If the
message had been "mysql daemon is not running", I would have known
just where to start. If it could have at least had the decency to say
"/var/db/mysql/mysql.sock not found", it's not ideal, but at least you
have an idea of where to start. End rant.
cd /var/db/mysql
brix.vintners.net.err
). Search for "error". Found:[ERROR] Unix socket lock file is empty /var/db/mysql/mysql.sock.lock.
.[ERROR] Unable to setup unix socket lock file.
mv mysql.sock.lock mysql.sock.lock.bak
$OldPswdCmd = "PASSWORD('".$_REQUEST[$gActionLoginPswd]."')"; $NewPswdCmd = "SHA2('".$_REQUEST[$gActionLoginPswd]."', 256)"; $PswdCmd = $OldPswdCmd; $MustUpdateOldPswd = (strlen($mysql->Pswd) <= 41); if (!$MustUpdateOldPswd) { $PswdCmd = $NewPswdCmd; }Note that you will have to have every user login before the upgrade to mysql8 in order for the auto update to happen.
pkg_upgrade
. Was at
mysql57-server-5.7.something-or-other, and it did an upgrade
to 5.7.9.29_1
. Afterwards, server would not start.Message from mysql57-server-5.7.29_1: -- Remember to run mysql_upgrade the first time you start the MySQL server after an upgrade from an earlier version.I couldn't do the
mysql_upgrade
as the server would
not start. There was no info from the start command. Looking in the
log got me closer:2020-04-28T17:45:38.377045Z 0 [ERROR] I/O error reading the header from the binary log, errno=175, io cache code=0Googling for this got me several different pages, most of which said to simply clobber the binary index file. So I renamed it out in case I needed it back.
cd /var/db/mysql/
mv mysql-bin.index mysql-bin.index.bak
service mysql-server start
mysql_upgrade --verbose -u
[user] -p
[20200326]
pkg install mysql80-server
Message from mysql80-server-8.0.19: -- There is no initial password for first time use of MySQL. Keep in mind to reset it to a secure password. MySQL80 has a default %%ETCDIR%%/my.cnf, remember to replace it with your own or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.
pkg install mysql56-server mysql56-client
Edit /etc/rc.conf
and add:
mysql_enable="YES"
[20200326]
Now go to /usr/local/etc/mysql
If there isn't already one:
cp my.cnf.sample my.cnf
Now edit my.cnf
; there are two places in the file you'll
need to modify, just search for "socket"; one in the client section,
the other in the server section. Change these both to point
to /var/db/mysql/mysql.sock
.
Once you've installed, start it via:
service mysql-server start
This is how you will start and stop it henceforth.
[20200329 - old news, skip to mysql_secure_installation]
Now do:
mysqladmin -u root password 'yourpassword'
You can ignore the warning about insecure -- this is the only time you
will EVER use a password on a command line -- the command line can be
seen be anyone on the system using "ps". We can get away with it here
as we're running a program that completes in less than a second.
Always use -p
WITHOUT the pswd when
using mysql
.
/tmp/mysql.sock
. THERE SHOULDN'T
BE, DAMNIT! All the web searching and trying stuff, I never found
REAL a way that actually fixes this problem. So -- kludge it:ln -s /var/db/mysql/mysql.sock mysql.sock
rehash
mysql_secure_installation
/var/db/mysql/
[full
hostname].err
and check for hidden problems./usr/local/etc/my.cnf
:expire_logs_days = 30
binlog_expire_logs_seconds = 2592000
skip_symbolic_links
/var/db/mysql/[full hostname].err
Now loading my sqldump file from the older system:
mysql -u root -p
[password]
source
[backup file from other system];
(buncha stuff goes by, no errors spotted)
flush privileges;
At this point, all should work, but instead, the damn thing starts
blowing chunks and restarting over and over again. Evidently it
doesn't like something in the old backup file. I'll have to go
through and backup one db at a time, transfer each, and load each
until I find the bad one, assuming of course it's only one that it
doesn't like.
I don't have enough time in my life for this FUCKING BULLSHIT.
Start all over -- AGAIN.
pkg remove mysql56-server mysql56-client
cd /var/db
rm -R mysql
888 GOTO 10
mysql -u root -p -D
[dbname] <
[mysqldumpfile]create user '
[username]'@'localhost';
grant all on
[dbname].* to '
[username]'@'localhost' identified by '
[userpswd]';
flush privileges;
mysql -u
[username] -p
service mysql-server stop
pkg remove mysql80-server
cd /var/db
rm -R mysql
pkg install mysql80-server
Just did it all again, this time the "factory restore" worked.
Still getting stupidfuck gtid error on goddamn grant command
though. Fucking bullshit.
mysql -u root -p < backup.sql
service mysql-server stop
mysqld_safe --user=mysql --upgrade=FORCE &
mysqladmin -u root -p shutdown
service mysql-server start
pkg install mysql57-server
rehash
my.cnf
. I had to back
out the mysql8 changes I had made. You could probably just copy in
the sample, then change the two socket lines to
/var/db/mysql/mysql.sock from /tmp.default_password_lifetime = 0
mysql_secure_installation
mysql -u root -p --connect-expired-password
alter user 'root'@'localhost' identified by '
[your pswd]' password expire never;
mysql -u root -p < backup.sql
service mysql-server restart