MySQL does not display during setup of Zabbix - mysql

I have issue during Zabbix 2.4-1 installation on ubuntu 14.04.
I used manual from official site, installation was successful, no errors.
Next I created user 'zabbix' with all privileges and database 'zabbix' and imported schema.sql, images.sql and data.sql from Zabbix archive. Then I changed configuration files in /etc/zabbix dir:
zabbix.conf.php
// Zabbix GUI configuration file
global $DB;
// Valid types are MYSQL, SQLITE3 or POSTGRESQL
$DB["TYPE"] = 'MYSQL';
$DB["SERVER"] = 'localhost';
$DB["PORT"] = '3306';
// SQLITE3 use full path to file/database: $DB["DATABASE"] = '/var/lib/zabbix/zabbix.sqlite3';
$DB["DATABASE"] = 'zabbix';
$DB["USER"] = 'zabbix';
$DB["PASSWORD"] = 'root';
// SCHEMA is relevant only for IBM_DB2 database
$DB["SCHEMA"] = '';
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
zabbix-server-mysql.conf
...
# dbc_dbtype: type of underlying database to use
# this exists primarily to let dbconfig-common know what database
# type to use when a package supports multiple database types.
# don't change this value unless you know for certain that this
# package supports multiple database types
dbc_dbtype='mysql'
# dbc_dbuser: database user
# the name of the user who we will use to connect to the database.
dbc_dbuser='zabbix'
# dbc_dbpass: database user password
# the password to use with the above username when connecting
# to a database, if one is required
dbc_dbpass='root'
...
I start it with apache server. When I go to localhost/zabbix I see Zabbix Installer. On step 3 it's necessary to configure DB connection. So, here is a problem:
As you see, in select list is only PostgreSQL, so, I can't connect to database (mysql server is running) and go to the next step.

Your PHP doesn't support MySQL at the moment. You need to install some php-mysql* package and then restart your webserver.

Your php package for mysql is not there so that it will not show while zabbix setup installation
install php-mysql package to resolve this error
#apt-get install php7.0-mysql
and then restart apache
#systemctl restart apache2

I had the same problem installing Zabbix 4.0 on Ub
So I ran
apt install php libapache2-mod-php php-mysql
sudo service apache2 restart
it works for me

Related

error on starting grafana service

I have grafana 4.4.3 on an ubuntu 16.4 LTS which is installed on an vm and its IP is 1.2.3.4 .
I also have a mysql database version 5.0.95 on a CentOS 5.9 and its ip is 5.5.5.5 and mydatabase name is : voip
I want to set mysql as backend for grafana. I'v changed my grafana.ini file like this:
###[database]###
type = mysql
host = 5.5.5.5:3306
name = voip
user = root
password = t#123
###[session]###
provider: mysql
provider_config = `root:t#123#tcp(5.5.5.5:3306)/voip`
I also set my root account to be used as a remote account.
when I want to start grafana-server service, it gives me this error:
Fail to initialize orm engine" logger=sqlstore error="Sqlstore::Migration
failed err: this user requires old password authentication. If you still
want to use it, please add 'allowOldPasswords=1' to your DSN. See also
https://github.com/go-sql-driver/mysql/wiki/old_passwords\n"
what should I do? Did I don anything wrong?
allowOldPasswords error is given when you are using old version of mysql database. to change this you should go to /etc/my.cnf and change oldpasswords = 1 to oldpasswords = 0. next you have to login to your mysql and then enter these commands:
SET SESSION old_passwords=FALSE;
SET PASSWORD FOR 'user_name'#'%'=PASSWORD('<put password here>');
flush privileges;
and at last, restart your mysql service.
hope this post is helpful...

zabbix error The frontend does not match Zabbix database

install zabbix at Configure DB connection error The frontend does not match Zabbix database.
i use mysql
What is the meaning of this?
This means that the version of the Zabbix database does not match what Zabbix frontend is expecting. For instance, if you are upgrading from Zabbix 2.2 to Zabbix 3.0, then you will get a similar message (together with the current database version and the expected database version) until you upgrade the database (this is done by simply running the new version of Zabbix server).
In this particular case, if you are installing for the first time, then you probably have not imported schema.sql, images.sql, and data.sql files yet. In that case, please consult "Installation from sources" and "Database creation scripts" sections in the online Zabbix documentation.
In case you have been using Ubuntu 14.04 and trying to do a new install of Zabbix 3.0 then you should first populate the database with the sql file provided in /usr/share/doc/zabbix-server-mysql/create.sql. After that it should work.
installation error: frontend does not match Zabbix database
read more here:
drop existing zabbix db
then
shell> mysql -u<username> -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> quit;
shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql
# stop here if you are creating database for Zabbix proxy
shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql
shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sql
after that step 3 is ok...
I was upgrading a debian distro from 7 to 8 that had Zabbix installed. When this error appeared, what I did was to install the zabbix-server-mysql service by typing:
apt-get install zabbix-server-mysql
And that solved the problem.

Unable to connect to remote mysql server using unixodbc, libmyodbc

I'm a little green at this, and I hope the issue I'm having is a simple one...edit: new information at bottom
I need to make a connection to a remote mysql (Amazon RDS) database.
After following a few tutorials, I have unixodbc and libmyodbc installed and configured on the client, but when I try to connect via isql, I get the error
[08S01][unixODBC][MySQL][ODBC 5.1 Driver]Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[ISQL]ERROR: Could not SQLConnect
The most confusing part about this error is that I'm not trying to connect to a local database, but rather to a remote one. I do not have a mysql.sock file on the client...this isn't the issue though is it?
I'm sensing a configuration error but I'm just not sure what it could be.
If I run odbcinst -j then the output is:
DRIVERS............: /etc/unixODBC/odbcinst.ini
SYSTEM DATA SOURCES: /etc/unixODBC/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini
The content of /etc/unixODBC/odbcinst.ini is:
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib64/libmyodbc5.so
Setup = /usr/lib64/unixODBC/libodbcmyS.so
UsageCount = 5
[MySQL ODBC 515 Driver]
Description = ODBC 5.515 for MySQL
DRIVER = /usr/lib64/libmyodbc5-5.1.5.so
SETUP = /usr/lib64/unixODBC/libodbcmyS.so
UsageCount = 3
Please note that I had to make up this configuration myself, I did a find for libmyodbc* and found these two .so files, thus set up a driver for each of them. A search for libodbcmyS* yields:
/usr/lib64/unixODBC/libodbcmyS.so.1
/usr/lib64/unixODBC/libodbcmyS.so
/usr/lib64/unixODBC/libodbcmyS.so.1.0.0
So, I don't know what else that configuration could be.
The content of /etc/unixODBC/odbc.ini is:
[target_db]
Driver = MySQL
Server = [servername.com]
Port = 3306
Database = [databasename]
Option = 2
User = [username]
Password = [password]
I've tried different options in "Driver", changing it from MySQL, to MySQL ODBC 515 Driver, to the path to the .so file (eg: /usr/lib64/libmyodbc5.so) and all yield the same result.
I'm running:
odbcinst -i -d -f /etc/unixODBC/odbcinst.ini
Followed by:
odbcinst -i -s -l -f /etc/unixODBC/odbc.ini
Followed by:
odbcinst -s -q
Which prints out the name of my connection, ie [target_db]
Then, I try the connect:
isql -v target_db user password
or just
isql -v target_db
and get the error shown above.
Anyone happen to know what I'm doing wrong here? Thanks a bunch-
EDIT:
Wanted to mention that I'm able to connect to the database from this server using the mysql command line tools.
I installed a local mysql database, and I'm able to connect to this using isql. It seems to be ignoring my odbc.ini file entirely, i have to enter a name with the command, ie isql -v test-database, but it still tries to connect to localhost despite my settings.
I feel as though I've tried everything but will keep at it and will post if i find a solution.
You could try to connect using the ip of your server instead of the dns entry on the "Server" line of odbc.ini.. Have you verified the driver is installed with phpinfo()?
Try to set the environment variable ODBCINI with the path of your odbc.ini file.
Keep in mind that the odbc.ini file you point to must be "write-accessible" by the user that is running the program (i.e. the user must have permissions to write in this file).
chmod g+w .odbc.ini did it for me since we run the DB with ORACLE-Start and the crs-User seems to be in charge

create new database on xampp

How can I create new database on xampp on centos 5? When I hot mysql -u root -p in terminal it says no mysql command found. When I go to phpMyAdimn page it do not accepts my username/password. What to do in this situation to create new database? Mysql service of xampp is running because when I run "ps ax | grep mysql" I can see xampp mysql process.
Symptom: Create new database: No Privileges
Worked for me in "standard" xampp on linux after running /opt/lampp/lampp security:
To add a new database log in to phpmyadmin as user "root" with password as defined for user "pma".
I have to put this in an answer (for the syntax) and it will look like this (in some file called "createDB.php")
You can run it with command-line "php createDB.php", or you can use your browser to set the adress "createDB.php" in your localhost, when you copy your file in the opt/lampp/htdocs folder.
I did not test it but it should work.
<?php
$con = mysql_connect("localhost","louis","abc123");
if (mysql_query("CREATE DATABASE my_db",$con))
{
echo "Database created";
}
?>
As you have indicate mysql process is running.
So, try
locate mysql
which mysql
whereis mysql
It could be your login session does not include the actual path to mysql client program.

using unixodbc driver to connect to mysql, default database not working

I have my unixodbc odbc.ini configure file like this:
[test]
Driver = /usr/local/lib/libmyodbc5-5.1.8.so
Description = Connector/ODBC 5.1.8 Driver DSN
SERVER = 127.0.0.1
PORT = 3306
USER = root
Password =
DATABASE = test
OPTION =
SOCKET =
And the problem is that it will not use the database as specified above, which is 'test'.
What I have to do is to manually execute a direct sql to change to database and run my query:
SQLExecDirect(stmt, "USE test", SQL_NTS);
SQLExecDirect(stmt, "SELECT * FROM mytable", SQL_NTS);
Any idea on how should I get rid of the 'USE test' which is a mysql command.
Why is unixodbc not setting 'test' as the default db since it's already specified in the conf file?
As on windows the driver manager (unixODBC in this case) only acts on the Driver tag, all other entries in the DSN are up to the driver to interpret. It doesn't notice there is a database= entry and know by magic that in this driver it should execute a "USE" command, and for another call SQLSetConnectAttr( SQL_ATTR_CURRENT_CATALOG ).
On my copy of the MySQL driver, it certainly uses the database= entry. However, I would check that 1. The copy of the driver you are using is built to use the unixODBC lib to access the shared config file (libodbcinst.so), or the driver is reading it directly, and is reading the same ini file as unixODBC. Possibly check with strace to see what ini is opened after the driver is loaded. Maybe try setting ODBCINI=/path/to/your/odbc.ini
[test]
Driver = /usr/local/lib/libmyodbc5-5.1.8.so
Description = Connector/ODBC 5.1.8 Driver DSN
SERVER = 127.0.0.1
PORT = 3306
USER = root
Password =
**DATABASE** = test
**OPTION** = **3**
**SOCKET** =
and can change options between 1,2 too