How to change mysql password

How to change MySQL password

1. Login to mysql
    mysql -u root -p

2. Select Database mysql.
    use mysql;

3. Use this systax to change MySQL password.

SET PASSWORD FOR 'user-name-here'@'hostname-name-here' = PASSWORD('new-password-here');
UPDATE mysql.user SET Password=PASSWORD('new-password-here') WHERE User='user-name-here' AND Host='host-name-here';
Ref :

Laravel create dropdown list from database with concatidinate field


Sometime i want to create dropdown list from database with combine two field . You can use Fluent Query Builder and Eloquent.


{{Form::select('User', AccountUser::select(DB::raw('id') , DB::raw('concat (first_name," ",last_name) as full_name'))->where('account_group_id','=','3')->lists('full_name','id') ) }}

C# System.TypeInitializationException was unhandled exception [Solved]


When  i found error, I search for this exception.
Generally, a TypeInitializionException is thrown when another exception happens inside a static constructor.
Check for the InnerException property of the former, and you will get more information about the actual error.

my exception is.
{"The type initializer for 'Myproject.Main' threw an exception."}
and InnerException  is
{"Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d"}
It's error from MySql.Data . I fixed by remove and add reference again.

Install Cacti On CentOS


Assume you have this package

- Apache

Install Required Packages
1. Install php addon
yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-mysql php-snmp -y

2. Install net-snmp
yum install net-snmp-utils net-snmp-libs php-pear-Net-SMTP -y

3. Install rrdtool
yum install rrdtool -y

Start SNMP Service
service snmpd start
chkconfig snmpd on

Create Database for cacti
1. Login to mysql
mysql -u root -p
Enter password : xxxxx
2. Create Database
mysql > create database cacti;
3. Create User (chage username and password to your info)
mysql > grant all on cacti.* to username@localhost identified by 'password'
4. Reload Grant Table
mysql > flush privileges;

Check or edit php.ini
date.timezone = your timezone
--- Example ----
date.timezone = Asia/Bangkok    // Thailand

Install CACTI
1. Download cacti from
2. Unzip and upload file to   /var/www/html/cacti
3. Restore cacti database (chage mysql user and password to your info)
# mysql -u mysqluser -p cacti < cacti.sql
# Enter Password : mysqlpassword
4. Edit config file   "include/concifg.php"
5. Call cacti url =>  http://your ip/cacti
    -  Cacti Installation Guide Page 1  => Click Next
    -  Cacti Installation Guide Page 2  => Select New Install and Click Next
    -  Cacti Installation Guide Page 3  => Click Next
    -  Cacti Installation Guide Page 4  Login with defual Username and Password (admn , admin)
    -  Cacti Installation Guide Page 5  Change admin password

Create Contrab
1. vi /etc/cron.d/cacti
2. Add this command
*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1