Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Friday, November 6, 2009

MySQL 5.1 on Debian Local Host

Could not connect on localhost for user with host %, which presumably was a wildcard. Got access denied.

Connected as root, then ran

update mysq.user set host='localhost' where host='%';

And had to restart MySQL to have it take effect.

Thursday, October 15, 2009

MySQL5.1 on Debian Installation

I've been having issues installing MySQL5.1 on Debian, for the NHIN Connect port to Linux.

First I tried downloading the tarball and following the installation instructions in their INSTALL-BINARY file. One thing which needs modification is substituting useradd for adduser.

The problem, though was the installation script

script/mysql_install_db

was failing, as it could not find files. After messing with this for some time, I decided to delete everything, start over, and use the package manager:

aptitude install mysql-server

However this installed an instance of mysql without a root or mysql user. I could never authenticate against it.

Back to the tar - I'm now working on script/mysql_install_db

root>cd /usr/local/mysql
root>./scripts/mysql_install_db

FATAL ERROR: Could not find errmsg.sys

The following directories were searched:

/usr/share/english
/usr/share/mysql/english

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

Looks as though the "you must be either at the top level of the extracted archive" part does not work, so I'll specify basedir:

root>./scripts/mysql_install_db --basedir=.
Installing MySQL system tables...
091015 9:34:03 [ERROR] ./bin/mysqld: unknown option '--skip-bdb'
091015 9:34:03 [ERROR] Aborting

091015 9:34:03 [Warning] Forcing shutdown of 2 plugins
091015 9:34:03 [Note] ./bin/mysqld: Shutdown complete


Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.

You can try to start the mysqld daemon with:

shell> ./bin/mysqld --skip-grant &

and use the command line tool ./bin/mysql
to connect to the mysql database and look at the grant tables:

shell> ./bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com/. Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the ./scripts/mysqlbug script!

Ok, two oddities here.

1) I didn't specify --skip-bdb
2) /var/lib/mysql has no logs

The "Installation of mysql tables" message is from the script, the rest is from mysqld.

I modified the script to output its options and found these:

./bin/mysqld --language=./share/english --bootstrap --basedir=. --datadir=/var/lib/mysql --log-warnings=0 --loose-skip-innodb --loose-skip-ndbcluster --user=mysql --max_allowed_packet=8M --default-storage-engine=myisam --net_buffer_length=16K

So where is --skip-bdb coming from. After investigating, I found a global configuration file, my.cnf, which can specify options. It can be found in a number of places:

/etc/my.cnf
/etc/mysql/my.cnf
SYSCONFDIR/my.cnf
$MYSQL_HOME/my.cnf
defaults-extra-file
~/.my.cnf

Found one in /etc/mysql

#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#

So I commented out skip-bdb, and the script worked.

I finished out the installation instructions and started mysqld using

mysqld_safe --user=mysql

but it exited right away.

Nothing useful in the log, so I added the -log option:

091015 10:23:20 [Warning] The syntax '--log' is deprecated and will be removed in MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
091015 10:23:20 [ERROR] Can't find messagefile '/usr/share/mysql/english/errmsg.sys'

So I added a symbolic link to the missing dir

ln -s /usr/local/mysql/share /usr/share/mysql

restarted, and its running now. Wahoo!