MySQL, DBI, and DBD must be installed for MySQL database development using perl in Linux. Apart from the good DBI installation, MySQL and DBD installation are not so smooth. The following is a summary:
MySQL, DBI, and DBD must be installed for MySQL database development using perl in Linux. Apart from the good DBI installation, MySQL and DBD installation are not so smooth. The following is a summary:
MySQL, DBI, and DBD must be installed for MySQL database development using perl in Linux. Apart from the good DBI installation, MySQL and DBD installation are not so smooth. The following describes how to solve the installation error:
I. MySQL Database Installation
1. Download the MySQL Installation File
The following two files are required to install MySQL:
MySQL-server-5.1.34.i386.rpm
MySQL-client-5.1.34.i386.rpm
Http: Open this page. Find the "Linux x86 RPM downloads" option in the drop-down page, find the "Server" and "Client programs" items, and download the above two rpm files.
2. Install MySQL
The rpm file is a software installation package developed by Red Hat. rpm frees Linux from complicated procedures when installing software packages. The frequently used parameter of this command during installation is-ivh, where I indicates that the specified rmp package will be installed, and V indicates the detailed information during installation, h indicates that the "#" symbol appears during the installation to display the current installation process. This symbol will not stop until the installation is complete.
1) install the server
Run the following command in the directory with two rmp files:
[Root @ test1 local] # rpm-ivh MySQL-server-5.1.34.i386.rpm
The following information is displayed.
Warning: MySQL-server-5.1.34.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ######################################## ### [100%]
1: mySQL-server ##################################### ###### [100%]
...... (Omitted)
/Usr/bin/mysqladmin-u root password \ 'new-password \'
/Usr/bin/mysqladmin-u root-h test1 password \ 'new-password \'
...... (Omitted)
Starting mysqld daemon with databases from/var/lib/mysql
If the preceding information is displayed, the Server installation is complete. Run netstat to check whether the Mysql port is opened. If yes, the service is started and the installation is successful. The default Mysql port is 3306.
[Root @ test1 local] # netstat-nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
The above shows that the MySQL service has been started.
Run the mysql command to test whether the mysql service is normal.
Error 1:
[Root @ localhost perl] # mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock' (2)
Solution: # ln-s/var/lib/mysql. sock/tmp/mysql. sock
Error 2:
# Mysql
Can't connect to local MySQL server through socket '/var/lib/mysql. sock'
Solution: delete mysql. sock under/tmp
If there are different versions of mysql on the machine (not successfully installed), "rpm-ivh" will prompt a version conflict, you should uninstall the previous version.
View the information of different MySQL versions:
[Root @ localhost perl] # rpm-qa | grep-I mysql
MySQL-server-community-5.1.30-0.rhel5
MySQL-client-community-5.1.30-0.rhel5
Uninstall:
[Root @ localhost perl] # rpm-e MySQL-server-community
[Root @ localhost perl] # rpm-e MySQL-client-community
Then, Run "rpm-ivh" to install the tool.
2) install the client
Run the following command:
[Root @ test1 local] # rpm-ivh MySQL-client-5.1.34.i386.rpm
Warning: MySQL-client-5.1.34.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5
Preparing... ######################################## ### [100%]
1: mySQL-client ##################################### ###### [100%]
The installation is complete.
3) Enter mysql
[Root @ localhost DBD-mysql-2.9003] # mysql
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 59 to server version: 5.1.34-community
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
+ -------------------- +
3 rows in set (0.00 sec)
Mysql>