Support Questions
Find answers, ask questions, and share your expertise

not able to start ambari server

I am not able to start ambari server . I checked the log for the same , please find below :

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Caused by: Connection refused (Connection refused) 

at Method)

Error injecting constructor, java.lang.RuntimeException: Error while creating database accessor 
  at org.apache.ambari.server.orm.DBAccessorImpl.<init>(

while setting up ambari server I had choosen mysql as database . I am installing ambari server as root user and all activities are done only being root user .

but when I run mysql -u root -p it shows "bash: mysql: command not found "



@Anurag Mishra

The issue seems to be due to insufficient permission for the DB. First set of checks:

1. Check if the MySQL server is running using command 'ps -ef |grep mysql'.

2. If not running, then try 'service mysqld start' - This is for RHEL/CentOS 6. Try similar command for other flavour of OS.

3. Login to mysql shell as mysql, then refer link to configure MySQL.


@Anurag Mishra
That typically tells you Mysql is NOT Installed!!! You must explicitly install Mysql, MariaDB or SQL server or Oracle before launching the Ambari installation

I assume you already run the below command

# yum install -y ambari-server 

Here are 2 methods for installing mysql and MariaDB

Install and start Mysql server on Centos 6

# yum install -y mysql-server
# chkconfig mysqld --level 345 on
# yum install -y mysql-connector-java
# yum update
# init 6
# service mysqld status 
# service mysqld start    */if mysql is down*/
# service mysql stop     */if mysql is running */
# service mysql restart  */if mysql is down*/ 

Install MySQL or MariaDB database for Ambari on Centos/RHEL 7

sudo yum install -y mysql-connector-java
ls /usr/share/java/mysql-connector-java.jar
sudo yum install -y mariadb-server
sudo systemctl enable mariadb
sudo systemctl start mariadb 

Setup Ambari

sudo ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar 

Setup the Ambari user for MySQL

The setup should now work and not error out with mysql -u root -p it shows "bash: mysql: command not found "

 mysql -u root -pxxxxx 
create ambari user with the proper grants here !!!! 

Create the Ambari DB as user Ambari

mysql -u ambari_user -pambari_password

Hope that helps