0

in case i just type mysql -u root -p and enter my password i enter to my database but now i still get one message every time i say mysql and any option like this output

root@Dodge:~# mysql
Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status
root@Dodge:~# mysql -u root
Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status
root@Dodge:~# mysql -u root -p
Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status

this message mean the service not running right ? but when i run status i get the services is active

root@Dodge:~# systemctl status mysql
● mariadb.service - MariaDB 10.5.9 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
     Active: active (exited) since Thu 2021-05-13 10:33:27 EET; 16min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
      Tasks: 0 (limit: 9337)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/mariadb.service
root@Dodge:~# systemctl status mariadb
● mariadb.service - MariaDB 10.5.9 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
     Active: active (exited) since Thu 2021-05-13 10:33:27 EET; 16min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
      Tasks: 0 (limit: 9337)
     Memory: 0B
        CPU: 0
     CGroup: /system.slice/mariadb.service

is active so why still give me

Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status

i was try to uninstall every thin and re install it and install with secure & update my system - i use kali-linux Based on debian for many years and there's no problem with it .

Edit

When i run mysql status i get this logs in the bottom too

ay 13 11:15:37 Dodge mariadbd[14041]: 2021-05-13 11:15:37 3 [Warning] Access denied for user 'roo…rd: NO)
May 13 11:15:37 Dodge mariadbd[14041]: 2021-05-13 11:15:37 4 [Warning] Access denied for user 'roo…rd: NO)
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: /usr/bin/mysql_upgrade: the '--basedir' option…nored
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: Looking for 'mysql' as: /usr/bin/mysql
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: Version check failed. Got the following error …lient
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: ERROR 1045 (28000): Access denied for user 'ro…: NO)
May 13 11:15:37 Dodge /etc/mysql/debian-start[14065]: FATAL ERROR: Upgrade failed
May 13 11:15:37 Dodge mariadbd[14041]: 2021-05-13 11:15:37 5 [Warning] Access denied for user 'roo…rd: NO)
May 13 11:15:37 Dodge debian-start[14078]: ERROR 1045 (28000): Access denied for user 'root'@'local…d: NO)
Hint: Some lines were ellipsized, use -l to show in full.
7
  • You seem to either have a misconfigured PATH or the mysql client was replaced by something else. To investigate, find out which mysql you are actually calling. The shell built-in type and the command which help. You could also use the full pathname of the mysql client when running it. Commented May 13, 2021 at 9:05
  • Your problem is most likely a client, not a server problem. However, the service is active but exited. I wonder whether it is running. Commented May 13, 2021 at 9:07
  • i install mariadb-client now and same problem i use which to mysql and i get 1 result /etc/init.d//mysql Commented May 13, 2021 at 9:15
  • so i use this command ? export PATH=${PATH}:/usr/local/mysql/bin Commented May 13, 2021 at 9:27
  • yes the problem is i add export PATH="/etc/init.d/:$PATH" inside .bashrc but ido that to run script direct with out full path Commented May 13, 2021 at 16:19

1 Answer 1

0

which mysql returns /etc/init.d/mysql. This is so because /etc/init.d is in your PATH before /usr/bin, which has the effect that you execute /etc/init.d/mysql when typing mysql.

You need to ensure that the location of the mysql client comes before /etc/init.d in the PATH. Or remove /etc/init.d from the PATH; I don't see any reason why it's there. Also, to make this change permanent, you need to change the setting of PATH in your profile or bashrc file.

Should you have reasons not to change the PATH variable, you need to launch the mysql client by providing its full pathname: /usr/bin/mysql.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .