Search This Blog

Sunday, March 6, 2016

Connection refused when starting MySQL

This appears to be a common issue with MySQL not accepting remote connections and cropped up for me a couple of times when installing Hortonworks HDP 2.4 and trying to use an existing MySQL for the Ambari database, Hive Metastore, Oozie and other Hadoop services.

Some steps taken to address the issue.

Confirm root access to mysql
https://www.digitalocean.com/community/questions/restoring-root-access-privileges-to-mysql

Check for running mysql processes and kill any that are running.
ps -A | grep mysql

Grant Remote Access
Change /etc/my.cnf adding a bind-address and port.
#/etc/my.cnf
bind-address=0.0.0.0 # this can be a static address if available.
port=3306

Restart service, in my case MariaDB on Centos7.
systemctl start mariadb

Check the log for errors.
cat /var/log/mariadb/mariadb.log

160306 12:04:52 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.44-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server


Create the Oozie and Hive Users & Databases.

Spin up the Hive Metastore.  Ambari will do this with a service restart or can test manually.
export HIVE_CONF_DIR=/usr/hdp/current/hive-metastore/conf/conf.server ; /usr/hdp/current/hive-metastore/bin/schematool -initSchema -dbType mysql -userName hive -passWord <enter_hive_password_here> -verbose

Helpful links

No comments:

Post a Comment