MySql57 no .mysql_secret after install

Hi,

I am trying to install mysql but none of the files containing the default password exist
Code:
root@rancid:/home/rancid # pkg info -D mysql57-server
mysql57-server-5.7.40:
On install:
Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret

MySQL57 has a default /usr/local/etc/mysql/my.cnf,
remember to replace it with your own
or set `mysql_optfile="$YOUR_CNF_FILE` in rc.conf.

On upgrade:
Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.

root@rancid:/home/rancid # 
root@rancid:/home/rancid # cat $HOME
cat: /root: Is a directory
root@rancid:/home/rancid # cat $HOME/.mysql_secret
cat: /root/.mysql_secret: No such file or directory
root@rancid:/home/rancid # cat root/.mysql_secret
cat: root/.mysql_secret: No such file or directory
root@rancid:/home/rancid # 
root@rancid:/usr/local/etc/mysql # 
root@rancid:/usr/local/etc/mysql # locate mysql_secret
root@rancid:/usr/local/etc/mysql # locate mysql57-server_secret
root@rancid:/usr/local/etc/mysql # 

root@rancid:/usr/local/etc/mysql # root/.mysql_secret
root/.mysql_secret: Command not found.
root@rancid:/usr/local/etc/mysql # /root/.mysql_secret
/root/.mysql_secret: Command not found.
root@rancid:/usr/local/etc/mysql # $HOME/.mysql_secret
/root/.mysql_secret: Command not found.
root@rancid:/usr/local/etc/mysql # /$HOME/.mysql_secret
//root/.mysql_secret: Command not found.
root@rancid:/usr/local/etc/mysql #
root@rancid:/home/rancid # 
root@rancid:/home/rancid # cd /usr/local/etc/mysql
root@rancid:/usr/local/etc/mysql # ls -lah
total 40
drwxr-xr-x   3 root   wheel   512B Apr  6 15:36 .
drwxr-xr-x  39 root   wheel   2.0K Apr  6 15:36 ..
drwxr-x---   2 mysql  mysql   512B Mar 21 01:54 keyring
-rw-r--r--   1 root   wheel   2.2K Mar 21 01:54 my.cnf
-rw-r--r--   1 root   wheel   2.2K Mar 21 01:54 my.cnf.sample
 
Start the service. If I recall correctly this is set up the first time you start it.
 
This file is empty until you do secure installation:
# mysql_secure_installation

But before above command you should start mysql-s
erver:
# service mysql-server start

The documentation is really annoying at times. it cleary highlights this happens ot install. lol chasing my tail again

On install:
Initial password for first time use of MySQL is saved in $HOME/.mysql_secret
ie. when you want to use "mysql -u root -p" first you should see password
in /root/.mysql_secret
 
This file is empty until you do secure installation:
# mysql_secure_installation

But before above command you should start mysql-server:
# service mysql-server start

now receive this error


root@rancid:/usr/local/etc/mysql # service mysql-server start
Starting mysql.
root@rancid:/usr/local/etc/mysql # mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'prompt=\u@\h [\d]>\_'

Securing the MySQL server deployment.

Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
 
Let's try it again!

Stop mysql-server:
# service mysql-server stop

Then remove MySQL folder in /var/db/mysql:
Be aware that this command will erase all MySQL data.

# rm -rf /var/db/mysql/*

Start MySQL again:
# service mysql-server start

Add enable it on /etc/rc.conf:
# sysrc mysql_enable=yes

Make sure MySQL is running:
# service mysql-server status

Do the secure installtion (you have to type Y and set a password:
# mysql_secure_installation
 
Let's try it again!

Stop mysql-server:
# service mysql-server stop

Then remove MySQL folder in /var/db/mysql:
Be aware that this command will erase all MySQL data.

# rm -rf /var/db/mysql

Start MySQL again:
# service mysql-server start

Add enable it on /etc/rc.conf:
# sysrc mysql_enable=yes

Make sure MySQL is running:
# service mysql-server status

Do the secure installtion (you have to type Y and set a password:
# mysql_secure_installation


wil do.


I believe I need to either update or replace the my.cnf file, but not sure which. Also not sure what needs changing within the file. The notes dont direct you at any sources.
 
# rm -rf /var/db/mysql

Start MySQL again:
# service mysql-server start
rm -rf /var/db/mysql/*
The service is going to fail to start if /var/db/mysql doesn't exist or doesn't have the correct permissions.
 
wil do.


I believe I need to either update or replace the my.cnf file, but not sure which. Also not sure what needs changing within the file. The notes dont direct you at any sources.
Deleting the contents of the mysql folder in /var/db/mysql solves the mysql.sock problem. Have you edit my.cnf file? otherwise, there seems no need to change it.
 
Deleting the contents of the mysql folder in /var/db/mysql solves the mysql.sock problem. Have you edit my.cnf file? otherwise, there seems no need to change it.

No I haven touched it. The notes say to make sure you change it to your file and thats it, Not sure if I just simply need to change the file name,, or I need to edit or replace it and change parameters.. Im still asking google
 
The notes say to make sure you change it to your file and thats it
Only if you have a custom my.cnf settings file in a different location. But this is a brand new installation, so it doesn't really apply.
Not sure if I just simply need to change the file name,, or I need to edit or replace it and change parameters.. Im still asking google
You don't have to do anything, just let it use the default /usr/local/etc/mysql/my.cnf.
 
Oh, regarding 5.7. Do you have any specific requirements for that version? Or do you just want to install a database server to play with? If the latter I would suggest installing databases/mysql80-server instead. MySQL 5.7 will be EoL some time soon and the default MySQL version already changed to 8.0 (see this thread) . Which means that packages and ports will depend on the MySQL 8.0 client.
 
Deleting the contents of the mysql folder in /var/db/mysql solves the mysql.sock problem. Have you edit my.cnf file? otherwise, there seems no need to change it.

that worked thanks


but now the update fails

root@rancid:/var/db/mysql # mysql_upgrade
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
 
Oh, regarding 5.7. Do you have any specific requirements for that version? Or do you just want to install a database server to play with? If the latter I would suggest installing databases/mysql80-server instead. MySQL 5.7 will be EoL some time soon and the default MySQL version already changed to 8.0 (see this thread) . Which means that packages and ports will depend on the MySQL 8.0 client.

Its to support Zoneminder.

I have Rancid and OpenVPN on the same box
 
MySQL does not work without a root password due to security issues. You must enter the parameter -p (password):

# mysql -u root -p
 
MySQL does not work without a root password due to security issues. You must enter the parameter -p (password):

# mysql -u root -p

I can log in and get a > prompt

>mysql_upgrade doesnt do anything just moves to the next line
 
MySQL does not work without a root password due to security issues. You must enter the parameter -p (password):

# mysql -u root -p


ok now my password has expired already

Upgrade process encountered error and will not continue.
root@rancid:/var/db/mysql # mysql_upgrade -p
Enter password:
mysql_upgrade: Got error: 1862: Your password has expired. To log in you must change it using a client that supports expired passwords. while connecting to the MySQL server
Upgrade process encountered error and will not continue.
root@rancid:/var/db/mysql # mysql_upgrade -p
Enter password:
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
root@rancid:/var/db/mysql #
root@rancid:/var/db/mysql # mysql_upgrade -p
Enter password:
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
root@rancid:/var/db/mysql #
 
There's nothing to upgrade, so don't run mysql_upgrade(1). It is only required if you upgraded the database from a previous version. This is a clean install, there is no 'previous', existing, database.
 
There's nothing to upgrade, so don't run mysql_upgrade(1). It is only required if you upgraded the database from a previous version. This is a clean install, there is no 'previous', existing, database.


why is the documentation os misleading?

On upgrade:
Remember to run mysql_upgrade the first time you start the MySQL server
after an upgrade from an earlier version.
 
Back
Top