0

I have a hosting which included some database problem is I can not access to mysql.

database are in .ibd / .frm

I have a few problems:

  • I don't know the password of mysql ( I did not create it) and don't know how to reset it
  • I don't know how to export the database. I tried to install phpmyadmin but because I don't know the password I can not connect
  • I tried to connect with Mysql Workbench but I got the result: Failed to connect to mysql (lost connection to Mysql Server at "reading initial communication packet, system 0

When I try to follow procedure to reset mysql password I did first:

sudo mysql stop

but I get the following error:

sudo: unable to open /etc/sudoers.d/README: No such file or directory
stop: Unknown instance: 

How can I get access to this database and what is the best way to export it?

ChinaXiaoHong
  • 139
  • 1
  • 4
  • 19

1 Answers1

1

you have several issues here. First of all you need to check your sudo setup and privileges: https://askubuntu.com/questions/482932/sudo-unable-to-stat-etc-sudoers-d-readme-no-such-file-or-directory

Second, you don't stop the service like this. Assuming that you have openrc it would be: /etc/init.d/mysql stop

And finally you have to start mysql in safe mode to change the root password. Follow this thread: MySQL root password change

juliokarl
  • 76
  • 1
  • 6
  • Thank you, when I check sudo setup and privileges by ls -l /etc/sudoers.d/, I get: total 4 -r--r----- 1 root root 958 Feb 11 2014 README. I did how you mention the mysql stop and start. I found maybe the problem. When I start again I got this error: * /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full! That is why maybe I can not restart mysql. Do you have any idea what I can do with this partition? – ChinaXiaoHong Jan 06 '18 at 15:08
  • Thanks for the help, after my previous message, I did clean the disk reset password and now I can use phpmyadmin. However I don't know how to see the database from /etc/mysql/mydata It is not on my phpmyadmin – ChinaXiaoHong Jan 06 '18 at 15:35
  • After you changed the password you have to start the service normally, not in safe mode. check the status with: /etc/init.d/mysql status In phpmyadmin you have to configure the servername (localhost) and Port (3306) in case you install it on the same server as the mysql-service. Before you setup phpmyadmin you can check that your server is running correctly by running the mysql client this way: mysql -u root -p it will ask you for your root password, when everything is correct it drops you to the mysql shell – juliokarl Jan 06 '18 at 16:00
  • you are a king @juliokarl thank you! everything works until now. Just need now to figure out how to merge all of these databases – ChinaXiaoHong Jan 06 '18 at 16:03