I am having a big problem trying to connect to mysql. When I run:
/usr/local/mysql/bin/mysql start
I have the following error :
<
CentOS 7, 64 bit. Fresh installation.
In my case, the error was because I didn't have the right MySQL server and MySQL client installed.
Using yum
, I removed mariadb
and mysql-community edition. I downloaded the rpm's for the client and server from the official MySQL website and installed the server and client.
On installing the server, I was shown a message that the password to the root account for MySQL was stored in a file which I could view with sudo cat /root/.mysql_secret
.
So after installing the client and server, I checked if MySQL was working (I think I rebooted before doing so) with the command sudo service mysql status
and I got the result.
MySQL running (2601) [ OK ]
I logged into MySQL using the password from the .mysql_secret file:
mysql -uroot -pdxM01Xfg3DXEPabpf
. Note that dxM01Xfg3DXEPabpf
is the password mentioned in the .mysql_secret file.
and then typed entered the following command at the mysql prompt to change the password of root:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('somePassword');
Everything worked fine from then on.