LVE Stats2 and MySQL DB Server Compatible Work Setup

Navigation:  LVE-Stats 2 > Configuration >

LVE Stats2 and MySQL DB Server Compatible Work Setup

Previous pageReturn to chapter overviewNext page

Note. Run all the commands below under root.


1. MySQL Server Setup


If MySQL Server is not installed, then install it according to control panel documentation.


For non-panel system:


(CloudLinux 6)


yum install mysql mysql-server

service mysqld start

chkconfig mysqld on


(CloudLinux 7)


yum install mariadb mariadb-server

systemctl start mariadb.service

systemctl enable mariadb.service



2. Database Setup


1. Run MySQL administrative utility: mysql.


2. In utility run the commands:




CREATE DATABASE db_lvestats2;


creating server DB. Also, check Note below.




CREATE USER 'lvestats2'@'localhost' IDENTIFIED BY 'lvestats2_passwd';


creating a user for LVE Stats 2 server to work under. Also, check Note below.




GRANT ALL PRIVILEGES ON db_lvestats2.* TO 'lvestats2'@'localhost';


granting all the privileges for all DB tables to the user. Use the username and DB name from points a. and b. above.






refreshing privileges information.


e. Exit administrative utility (Ctrl+d).


Note. DB name, username and their passwords above are given for an example - you can use any of your choices. Using old DB from LVE Stats version 1 is also acceptable as LVE Stats2 uses different tables and the old information will not be corrupted.



3. LVE Stats 2 Setup


Stop LVE Stats 2 server running the command:


service lvestats stop


In server configuration file /etc/sysconfig/lvestats2 edit the following options:


db_type = mysql

connect_string = lvestats2:[email protected]/db_lvestats2


Note that connect_string option value is used in format: user:[email protected]/database. Username, password and DB name must be the same as in point 2.b. of Database Setup above.


After making changes in configuration files run




for DB primary initialization (creating tables, indexes, etc). There is no need to create anything in the DB manually.


When done, restart server running:


service lvestats restart



4. Additional Security Settings


If you need to provide access to LVE Stats information utilities (lveinfo, lvechart, lve-read-snapshot) for different users, then we recommend creating one more DB user with read-only privilege to guarantee information security. It can be done by running the following commands in administrative utility:




CREATE USER 'lvestats2_read'@'localhost' IDENTIFIED BY 'lvestats2_read_passwd';


creating a user (check Note above).




GRANT SELECT ON db_lvestats2.* TO 'lvestats2_read'@'localhost';


granting read-only privilege to the user.






refreshing privileges information.


If LVE Stats2 server is set correctly (see information below), the information utilities will work under this user.


If you need to provide access to information utilities to other users, then in order to guarantee information security you should do the following:


а) Assign permission 600 to the main configuration file (/etc/sysconfig/lvestats2), so that it could be read only by LVE Stats 2 server and by utilities that run under root.


b) Copy /etc/sysconfig/lvestats2 to /etc/sysconfig/lvestats2.readonly, assign permission 644 to the new file, so that it could be read by any user but could only be changed by root.


с) In /etc/sysconfig/lvestats2.readonly file, in the line connect_string, specify DB user with read-only permission, created above.


These steps allow hiding main DB user username/password from other system users.


If there is no need in such access differentiation, then /etc/sysconfig/lvestats2 file access permission should be 644, so that it could be read by all users and could be changed only by root.



5. Using Special Characters in Database Password


Since scheme://user:[email protected][:port]/database_name URI is used in connect_string config option, then usage of special characters in user DB password is not allowed . To use special symbols in the password, it must be converted to escape-sequence. You can convert a password to escape-sequence in a console as follows:


echo -n '[[email protected]$$]:' | perl -MURI::Escape -ne 'print uri_escape($_)."\n"'



Or replace the symbols manually:


!    #    $    &    '    (    )    *    +    ,    /    :    ;    =    ?    @    [    ]

%21  %23  %24  %26  %27  %28  %29  %2A  %2B  %2C  %2F  %3A  %3B  %3D  %3F  %40  %5B  %5D


After that сonnect_string will look as follows:


сonnect_string=lvestats2:%5BYou_P%40%24%24%5D%[email protected]/db_lvestats2