Cannot run MySQL after unzipping from a tar archive

1.4k views Asked by At

After downloading mysql tar file archive, unzipped it in a directory (no installation).

Now when i run this from command-line:

/somedir/mysql-5x/bin/mysqld

I see following errors:

[Note] ./mysqld (mysqld 5.6.25) starting as process 5310 ...
[ERROR] Can't find messagefile '/usr/local/mysql/share/errmsg.sys'
[Warning] Can't create test file /usr/local/mysql/data/me-MacBook-[Warning] Can't create test file /usr/local/mysql/data/me-MacBook-Pro.lower-test
./mysqld: Can't change dir to '/usr/local/mysql/data/' (Errcode: 2 - No such file or directory)
[ERROR] Aborting
[Note] Binlog end

This is a mac machine, i have tried via sudo command as well - but that does not help.

4

There are 4 answers

2
scai On

Try passing parameter -b or --basedir= for specifying the path to your installation directory. E.g.:

/somedir/mysql-5x/bin/mysqld --basedir=/somedir/mysql-5x/

0
shivams On

You need to install mysql to run it properly. When mysql start running it reads various configuration parameters from configuration files which normally is my.cnf. Among those parameters there is one which tells mysql where is the data directory. Data directory contains schema, tables etc which are needed by mysql to get started.

It looks like for your version of mysql default data directory is /usr/local/mysql/data/. Since mysql is not installed it will not find data directory there. Also i only mention one parameter i.e. data directory. There are various others which are required.

I suggest you to install mysql and then use it.

2
BK435 On

While scai answer would get you passed your initial issue. You will undoubtedly run into more issues. You cannot run mysql properly the way you are trying to. You will run into errors and mysql will crash. You have to initialize Mysql first.

sudo mysql_install_db –user=mysql

There are several internal mysql databases that mysql uses called:

performance_schema,information_schema,mysql

Without these databases and the metadata files (such as ibdata1 file) your mysql server will not function properly. Hence, the reason why you are now getting the error: Table mysql.user doesn't exist

These resources might help you in your current Mac environment:

http://akrabat.com/setting-up-php-mysql-on-os-x-yosemite/

http://dev.mysql.com/downloads/mysql/

0
ems issuetrack On

I have faced the same issue with installation of mysql 5.7.11. The issue got solved after setting the /etc/my.cnf as mentioned below :

basedir=<somedir>/mysql

datadir=<somedir>/mysql/data