1. Install MySQL under FreeBSD
Tar zxf mysql-5.0.41.tar.tar
Cd mysql-5.0.41
. /Configure -- prefix =/home/happyiww/mysql-5.1.18-beta -- with-tcp-port = 7788 -- with-unix-socket-path =/tmp/happyiww. mysql. sock -- with_innodb -- enable-thread-safe-client --> This is specifically set to use ssl, because MySQLdb needs to link to this library. I once installed mysql on a debian platform. If the error termcap cannot be found, install ncurse and add -- with-named-curses-libs =/usr/lib/libncursesw. so.5 or -- with-named-curses-libs =/usr/lib/libncurses. a. If readline/libedit is missing in the system, add -- without-readline and -- without-libedit at the end of the configuration command, if it is added before the option -- with-named-curses-libs, it does not seem to be valid.
Make
Make install
Note: During MySQL installation, several errors may be reported in the test stage, but the running of make install is not affected. In fact, after the installation is complete, the MySQL database has not yet been created and data must be manually created. Let's take a look at how to initialize the database (such as user tables)
Create a MySQL instance
See the configuration file (cp/home/happyiww/mmysql/share/mysql/my-small.cnf my. cnf) in/home/happyiww/share/mysql:
[Mysqld]
Port = 7788
Socket =/tmp/happyiww. mysql. sock
Datadir =/home/happyiww/mysqldata
Run/home/happyiww/mysql/bin/mysql_install_db -- user = happyiww -- defaults-file =/home/happyiww/my. cnf
Start mysql:/home/happyiww/mmysql/bin/mysql_safe &
Change the password;/home/happyiww/mmysql/bin/mysqladmin-u root-p password newpassword this is the password required by mysql, the new database password is blank, just press Enter.
Restart mysql
Now MySQL has been installed
2. Install MySQLdb
Tar zxf MySQL-python-1.2.2.tar.gz
Cd MySQL-python-1.2.2
Python setup. py install -- prefix =/home/happyiww/python24
Generally, libmysqlclient_r.so cannot be found in/usr/local/mysql.
In this case, copy the wrong compilation command:
Gcc XXXXX-L/usr/local/bin/mysql-lmysqlclient_r XXXX
Changed:
Gcc XXXXX-L/home/happyiww/lib/mysql-lmysqlclient_r XXXX
Compile directly, so there should be no problem --> Why? This is because the make mechanism decides whether to re-compile the file by comparing the Time of the file.
Then run python setup. py install -- prefix =/home/happyiww/python24.
It is installed now.