Linux系统下非管理员安装mysql


一、下载相关包(必须是源码包)
mysql-5.0.22.tar.gz

  二、运行configure
./configure --prefix=/data1/zhangsc/local/mysql --with-mysqld-user=zhsc --with-unix-socket-path=/data1/zhangsc/local/mysql.sock --localstatedir=/data1/zhangsc/local/mysql/data --enable-assembler --with-mysqld-ldflags=-all-static --with-low-memory --with-mit-threads

  三、按照以往安装源码包的步骤进行make、make install

  四、编写my.cnf文件,文件内容如下:
[mysqld]

#数据库路径,里面的内容可以从运行正常的数据库中拷贝过来
datadir=/data1/zhangsc/local/mysql/data

#管道文件,指定管道文件的路径,与安装时configure中的配置一致
socket=/data1/zhangsc/local/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql

#mysql的库路径

basedir=/data1/zhangsc/local/mysql/lib/mysql

[mysqld_safe]

#mysql错误日志路径
err-log=/data1/zhangsc/local/mysql/log/mysqld.log

#mysql的pid路径无论哪里都行,只要有权限访问即可
pid-file=/data1/zhangsc/local/mysql/mysqld.pid

  五、启动数据库服务器:
  进入mysql的bin路径下运行一下程序即可:./mysqld_safe --defaults-file=my.cnf

相关内容