Home > Net >  How do I start and use a MySQL installation from source on Ubuntu 20.04?
How do I start and use a MySQL installation from source on Ubuntu 20.04?

Time:06-29

I've recently installed MySQL from source. I've been following the steps laid out within the official documentation. The preconfiguration setup appears to be working, however, the post installation setup is not. I'm running into a lot of errors, I've attempted to configure an options file but that didn't work. Here are the responses to some of the commands I have been running:

systemctl start mysqld

results in: "Failed to start mysqld.service: Unit mysqld.service not found."

mysql -v

results in: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"

/usr/local/mysql/bin/mysql --version

results in: "Ver 8.0.29 for Linux on x86_64 (Source distribution)"

I've tried defining the socket value, data directory and installation directory within an options file, however, was unsuccessful in getting it to run.

I'm wanting to know which steps I should take next, or if there is something different I could be doing. Any help would be greatly appreciated. Thank you.

CodePudding user response:

Let's forget about managing mysqld via system service for the time being. First of all, make sure mysql service is running by executing ps -ef | grep -i mysqld. If it's not running, try launching it manually from mysql's bin directory. e.g /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysql/mysql_error.log --pid-file=/usr/local/mysql/data/test.pid --socket=/var/lib/mysql/mysql.sock --port=3306 or simply /usr/local/mysql/bin/mysqld -u mysql
If there is something wrong which prevents mysql from starting, check the error log.

CodePudding user response:

first check which mysql is triggered by default. Open terminal and type which mysql Then you can see which executable is running when you run mysql.

I can see you have a working version of mysql stored in /usr/local/mysql/bin/mysql. You can add this executable to path if u want to work with this executable.

  • Related