The website's back-end database is converted to MySQL. Now it is much easier to connect to the database using Perl.
Through DBI, Perl can easily connect to the database:
#! /Bin/perl
Use dBi;
# Connect to target DB
My $ DBH = DBI-> connect ("DBI: mysql: Database = eygle; host = localhost", "username", "password ", {'raiseerror' => 1 });
# Insert one row
My $ rows = $ DBH-> do ("insert into test (ID, name) values (1, 'eygl ')");
# Query
My $ sqr = $ DBH-> prepare ("Select name from test ");
$ Sqr-> execute ();
While (my $ ref = $ sqr-> fetchrow_hashref ()){
Print "$ ref-> {'name'}/N ";
}
$ DBH-> disconnect ();
Execution result:
[Root @ eygle ~] # Perl test. cgi
Eygle
In the future, many statistics can be directly written to the MySQL database through Perl, which is much easier to operate.
It seems that this migration is worthwhile :)
-The end-