0
votes

When I'm use the find command to locate the MySQL location, it returns the below paths. But, I want to restart the MySQL. If I stop the path (/usr/bin/mysql) it shows the error

[Access denied to user 'root'@'localhost' with password='NO]'

so, Which MySQL will be get restart in the below paths ?

/usr/bin/mysql

/usr/share/mysql

/usr/lib/mysql

/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql

/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql

/usr/lib64/mysql

/var/lib/mysql

/var/lib/mysql/mysql

5
Is the error the same for each path? - Andrius Naruševičius
@Andrius Narusevicius No, The error is only for /usr/bin/mysql. for others it is showing as a directory - Dhileepan

5 Answers

1
votes

As root, run service mysqld restart

If that does not work, try /etc/init.d/mysqld restart

Instead of restart you can use :

start to start mysql

stop to stop it

1
votes

to stop mysql account is:

sudo mysqladmin -h localhost -u root -p shutdown

to start is: sudo systemctl start mysql.service

to confirm:

sudo mysql -h localhost -u root -p

NB: the default password for root account is root

**not sure but i think this closes connection for all accounts & also starts for all accounts though you have stop using an account with privilege access/root access by using the grant statement.

example

GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'localhost';

source http://www.luciopanasci.it/Ebooks/MySQL%20Cookbook,%203rd%20Edition.pdf page 2 topic 1.1**

0
votes

Usually you do

/etc/init.d/mysql start/stop/restart

It may be called mysqld or mysql-server or something like that. If you're on Ubuntu, you have to do

service mysql start/stop/restart

there it may be mysqld or mysql-server or something like this as well.

0
votes

If Mysql is running as a service:

sudo service mysql restart;

or

sudo service path/to/mysql restart;

Edit:

check if mysql is running

service --status-all
service --status-all | grep mysql
0
votes

If Mysql is running, use

To Restart: service mysqld restart

Other command which can be used if necessary are given below.

To Stop: service mysqld stop

To Start: service mysqld start