编译安装MySQL5.1.41
./configure --prefix=/usr/local/mysql --with-plugins=max --with-extra-charsets=all #出错 No curses/termcap library found #安装 ncurses后就正常了
make make install
chown -R mysql:mysql /mysql #改配置my.cnf #以mysql用户账号建立数据表 /usr/local/mysql/bin/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/ --user=mysql --pid-file=/mysql/mysql.pid --skip-locking --port=3306 --socket=/mysql/mysql.sock #启动mysql: /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf & #停止mysql: /usr/local/mysql/bin/mysqladmin -u root -p -S /mysql/mysql.sock shutdown
ps:后来换了datadir目录和socket,本地mysql命令连的时候就出错了 mysql -uroot -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/mysql/mysql.sock' (2) 后来发现是配置文件有冲突,删了以前/etc/mysql目录下的my.cnf下的就ok了