How to resolve mysqld_safe output on FreeBSD?

below commands are my way, tell me about How can I resolve my problem?

sockstat -4 -6 | grep mysql
killall mysqld

mysqld_safe --skip-grant-tables &
2019-01-09T15:22:25.6NZ mysqld_safe Logging to '/var/db/mysql/*'.
2019-01-09T15:22:25.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2019-01-09T15:22:26.6NZ mysqld_safe mysqld from pid file /var/db/mysql/*.pid ended

and here I cannot go to the next step [ mysql -u root : for change my MySQL root password ]

Meanwhile, I don't have /tmp/mysql.sock file

How did I install it?
I installed MySQL with below commands:
pkg install mysql57-server mysql57-client
nano /etc/rc.conf
mysql_enable="yes"
service mysql-server start

What is my problem exactly?
 
Never, ever, use kill(1) or killall(1) on the MySQL daemon. That's going to cost you one day, you can and will end up with corrupted databases. Do a proper shutdown; service mysql-server stop.

Don't start any of the processes by hand as root. Because that's going to screw up the permissions on the files MySQL uses. Use the proper service(8) commands to start, stop or restart it. That will make sure it starts with the correct parameters using the correct user account.

I assume you have an existing database and want or need to reset the root password? (there's no other reason for --skip-grant-tables)

Add to rc.conf:
Code:
mysql_flags="--skip-grant-tables"
And restart MySQL: service mysql-server restart

Once you're done remove the flags and restart MySQL again.
 
Never, ever, use kill(1) or killall(1) on the MySQL daemon. That's going to cost you one day, you can and will end up with corrupted databases. Do a proper shutdown; service mysql-server stop.

Don't start any of the processes by hand as root. ...
.
ok
I do that but here I get new error message code:
service mysql-server start
OUTPUT:
Starting mysql.
daemon: illegal option -- -
usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]
[-u user] [-o output_file] [-t title]
[-l syslog_facility] [-s syslog_priority]
[-T syslog_tag] [-m output_mask] [-R restart_delay_secs]
command arguments ...
/usr/local/etc/rc.d/mysql-server: WARNING: failed to start mysql

and with [service mysqld start]
[mysql -u root] NOT worked again,
OUTPUT IS :
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
additional command results:
I removed mysql_flags="--skip-grant-tables" from rc.conf


next:
service mysql-server stop
OUTPUT:
mysql not running? (check /var/db/mysql/Host.co.UK.pid).

sockstat -4 -6 | grep mysqld
OUTPUT:
mysql mysqld 17932 27 tcp46 *:3306 *:*

I forced to use:
killall mysqld

and circulate problem continued
 
Code:
daemon: illegal option -- -
That looks like you've made a typo in the flags.

OUTPUT IS :
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
You can't login if MySQL failed to start (or not running). The client's "Access denied" message is a red herring.


To avoid an XY problem, what exactly are you trying to do? Is this a new install? Or an existing install?
 
this is the existing install,
What is the difference between service mysqld restart and service mysql-server restart on FreeBSD?

by the way, this problem has been continued,
again I would like to show you my command list:


#-----------------------------------------------------------

service mysql-server restart
mysql not running? (check /var/db/mysql/*.pid).
Starting mysql.
#-----------------------------------------------------------

service mysql-server stop
mysql not running? (check /var/db/mysql/*.pid).
#-----------------------------------------------------------

sockstat -4 -6 | grep mysqld
mysql mysqld 17932 27 tcp46 *:3306 *:*
#-----------------------------------------------------------

killall mysqld
#-----------------------------------------------------------

mysqld_safe --skip-grant-tables &
#-----------------------------------------------------------

2019-01-09T16:30:29.6NZ mysqld_safe Logging to '/var/db/mysql/*.err'.
2019-01-09T16:30:29.6NZ mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
2019-01-09T16:30:30.6NZ mysqld_safe mysqld from pid file /var/db/mysql/*.pid ended
[1]+ Done mysqld_safe --skip-grant-tables
#-----------------------------------------------------------

mysql -u root
#-----------------------------------------------------------

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
#-----------------------------------------------------------

nano /etc/rc.conf
#-----------------------------------------------------------

mysql_flags="--skip-grant-tables"

#-----------------------------------------------------------

service mysql-server restart

#-----------------------------------------------------------

daemon: illegal option -- -

usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]

[-u user] [-o output_file] [-t title]

[-l syslog_facility] [-s syslog_priority]

[-T syslog_tag] [-m output_mask] [-R restart_delay_secs]

command arguments ...

/usr/local/etc/rc.d/mysql-server: WARNING: failed to start mysql

#-----------------------------------------------------------
remove
mysql_flags="--skip-grant-tables"
and again :
service mysql-server start
Starting mysql.
(~)> mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
#-----------------------------------------------------------
service mysql-server stop
mysql not running? (check /var/db/mysql/*.pid).

and etc
 
What is the difference between service mysqld restart and service mysql-server restart on FreeBSD?
There is no service named mysqld so service mysqld restart results in an error message ("mysqld does not exist...."), the service is called mysql-server (see /usr/local/etc/rc.d/mysql-server). The daemon the service starts is mysqld(8) via mysqld_safe(1).

MySQL probably now fails to start because you've been trying to run it as root. This will cause new files created to be root owned when they should be owned by the mysql user. And so it will fail to start when you start it correctly (because it cannot write or access those files). You can usually fix that with chown -R mysql:mysql /var/db/mysql.

Another possibility is that there's still a process running that's keeping everything locked. Because you're getting "mysql not running?" while sockstat(1) shows a process running and listening on 3306. That process is probably completely hung up now so it doesn't respond to a kill(1) signal any more. You can try to get rid of it with kill -9 <pid>. But don't take this lighthearted, this is a very destructive way of removing a process (it basically gets kicked out and doesn't get a chance to dump caches, close files, etc.) so you'll probably end up with databases and/or tables in an inconsistent state and may end up losing data.
 
There is no service named mysqld so service mysqld restart results in an error message ("mysqld does not exist...."), the service is called mysql-server (see /usr/local/etc/rc.d/mysql-server). The daemon the service starts is mysqld(8) via mysqld_safe(1).

....
this command gives me a result:
service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
( I think that I installed two mysql on my FreeBSD ! and all of these problems on it )
is any other way to change mysql root password?
 
I got a new error message and I found it now :
Code:
(~)> service mysql-server status
mysql is not running.
(~)> service mysql-server start
Starting mysql.
(~)> service mysql-server status
mysql is not running.

this is weird and strange, isn't it! with previous code
Code:
service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
I can see below code result
Code:
sockstat -4 -6 | grep mysql
but with this code, I cannot! What do you think?
 
and finally I found my problem, I have installed DirectAdmin on my FreeBSD and all of the problems on it,
I found my username and password with

Code:
cat /usr/local/directadmin/conf/mysql.conf
that's all! so easy, what do you think! :D
 
Back
Top