0

So I created my .bash_profile, opened it in a text editor and added:

export PATH=$PATH:/usr/local/mysql/bin

and then I saved it. Next, I tried running

sudo /usr/local/mysql/support-files/mysql.server start

was told to enter my password (so I did), and then terminal said

Starting MySQL 

and then it kept printing dots until it said:

ERROR! The server quit without updating PID file (/usr/local/mysql/data/Nicks-MacBook-Pro.local.pid).

The error logs look like:

2021-01-25T20:50:49.707062Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.23) starting as process 15092
2021-01-25T20:50:49.710232Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2021-01-25T20:50:49.834599Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-01-25T20:50:49.943719Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-01-25T20:50:50.037810Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2021-01-25T20:50:50.125494Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2021-01-25T20:50:50.126128Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2021-01-25T20:50:50.151069Z 0 [System] [MY-010931] [Server] /usr/local/mysql/bin/mysqld: ready for connections. Version: '8.0.23'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server - GPL.
~
~
~
~
~
(END)

How do I fix this?

nickcoding
  • 305
  • 8
  • 35
  • 1
    check the mysql error log and see what it has to say. – nbk Jan 25 '21 at 21:43
  • I tried running 'sudo less /var/log/mysql/error.log' immediately after and terminal returned 'No such file or directory' – nickcoding Jan 25 '21 at 21:46
  • 1
    you must check the mysql.ini file to see where mysql writes his files – nbk Jan 25 '21 at 21:48
  • How do I do that? – nickcoding Jan 25 '21 at 21:53
  • 1
    that depends on your distribution, every search engine will give you some hints where to find it – nbk Jan 25 '21 at 22:13
  • I've tried lots of different things--at the moment I'm looking through the /usr/local/mysql folder because it seems like that's where the error logs should be but all that's there is 'LICENSE', 'README', 'bin', 'data', 'docs', 'include', 'keyring', 'lib', 'man', 'share', and 'support-files'. I tried using the solution with 15 upvotes here https://stackoverflow.com/questions/54414309/error-the-server-quit-without-updating-pid-file-usr-local-var-mysql-username as I thought the issue was the same but I guess it's a different problem because it didn't work. – nickcoding Jan 26 '21 at 01:46
  • I also don't seem to have permission to access /usr/local/mysql/data. Not sure why and I think that might be one of the issues... – nickcoding Jan 26 '21 at 03:13
  • 1
    with sudo you can change this, as you gain temporary root privileges – nbk Jan 26 '21 at 08:19
  • @nbk I think I managed to access the error logs and updated the original question with them. Thoughts? – nickcoding Jan 26 '21 at 14:40
  • 1
    you should show us the mysql error log and eventual you should delete this question here and post a new one in DBA – nbk Jan 26 '21 at 20:06
  • I already put the error logs in the question – nickcoding Jan 26 '21 at 20:58
  • 1
    it doesn't show any error. you must have more ... isn't enough – nbk Jan 26 '21 at 21:16
  • @nbk Here's the link to all the commands I'm running, I don't think I'm missing anything but if I'm missing anything obvious you'll be able to tell. https://youtu.be/D6yBnpaFpVs – nickcoding Jan 26 '21 at 21:39
  • Are you installing on Windows? See https://dev.mysql.com/doc/refman/8.0/en/identifier-case-sensitivity.html – Rick James Jan 29 '21 at 23:32

1 Answers1

2

You should try to restart MySQL service after performing each step to check if the error is solved. But first, take a full backup of MySQL data directory /var/lib/mysql/ before you make any changes to MySQL service.

  1. Connect to your server via SSH as root user and restart MySQL manually. Sometimes restarting the MySQL server may fix this issue. You can use either of the following command to restart MySQL server.

/etc/init.d/mysql restart

or

service mysql restart

  1. You need to check whether the MySQL service is already running. If MySQL service is already running, you will have to kill them and start again. Use the following command to check if there is a MySQL service running already.

ps -aux | grep -i mysql

If MySQL service is already running, you will get list of MySQL processes with PIDs. The PID is the process ID of the MySQL processes. You will have to kill those processes.

kill -9 PID

PID – Process ID of the MySQL process.

  1. Check the ownership of MySQL data directory /var/lib/mysql/. Use the following command to check ownership of MySQL service

ll -aF /var/lib/mysql/

If it’s owner is root, you should change the ownership to MySQL or your user by using the following command.

chown -R mysql /var/lib/mysql/

  1. Take a backup of mysql.sock file and remove it. To achieve this, use the following commands:

cp /var/lib/mysql.sock /var/lib/mysql.sock_bkp

rm -rf /var/lib/mysql.sock

  1. Remove MySQL configuration file /etc/my.cnf or just back it up for now and restart:

mv /etc/my.cnf /etc/my.cnf.bak

  1. Remove the log file named ib_logfile in the MySQL data directory /var/lib/mysql/ or just back it up now and restart the MySQL service. Sometimes MySQL service fails to start when it faces difficulty in updating the log files. The log files will be created automatically once you restart the MySQL service. Use the following command to remove the log files and back it up.

Change the present working directory to MySQL data directory.

cd /var/lib/mysql

Backup and remove the log files by renaming them.

mv ib_logfile0 ib_logfile0.bak

mv ib_logfile1 ib_logfile1.bak

Move the backups to a temporary location.

mv /var/lib/mysql/ib_logfile* /tmp/folder/

  1. Find the log files with suffix “.err” in the MySQL data directory /var/lib/mysql/. These files contain the actual error message. You can use any editor or command like cat, less to read the error message from the log files.

cat /var/lib/mysql/yourservername.err

In many cases, MySQL will run soon after removing this error files.

rm -rf /var/lib/mysql/yourservername.err

S.S.Prabhu
  • 99
  • 10