发布网友 发布时间:2022-04-28 16:07
共1个回答
热心网友 时间:2022-04-09 05:36
linux下非root权限的mysql安装
下载mysql的安装包我用的是mysql-5.1.28-rc.tar.gz
1.把mysql-5.1.28-rc.tar.gz解压缩
tar -zxvf mysql-5.1.28-rc.tar.gz
2. 进入 解压后的文件夹 cd mysql-5.1.28-rc
3.编译 # ./configure --prefix=/***要安装的目录/mysql --with-charset=gbk --with-plugins=innobase
#make
#make install
4.安装目录/bin/ ./mysql_install_db --user=XX (xx为freebsd用户名)
5。拷贝一份配置到mysql的安装目录下面并且重新命名为my.cnf
cp support-files/ my-medium.cnf /***要安装的目录/mysql/my.cnf
6.修改my.cnf文件 socket的位置
port = 3308(看情况如果用原始端口没有必要修改)
socket = /***要安装的目录/mysql/mysql.sock (默认是在 /tmp/mysql.sock 因为我们是普通用户不能够操作/tmp/)
以下可以根据自己的需求来修改
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 1024
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
wait_timeout=800
default-character-set=gbk
max_connections=6000
basedir=/安装的路径/mysql
datadir=/安装的路径/mysql/var
query_cache_size = 256M
thread_cache_size = 100
7.启动mysql服务
/安装的路径/mysql/bin/mysqld_safe --defaults-file=/安装的路径/mysql/my.cnf
8.进入mysql数据库
/安装的路径/mysql/bin/mysqld -S /安装的路径/mysql/mysql.sock
ok 进入数据库了
或者这样:
1.拷贝一个conf文件到mysql目录,cp /home/自己目录/local/mysql/share/mysql/my-large.cnf /home/liuzuocheng/local/mysql/my.cnf2.修改my.cnf的port,和mysql.sock的目录,下面是我的配置
# The following options will be passed to all MySQL clients [client] #password = your_password port = 83306 socket = /home/liuzuocheng/var/mysql/mysql.sock # # Here follows entries for some specific programs # The MySQL server [mysqld] port = 83306 socket = /home/liuzuocheng/var/mysql/mysql.sock basedir = /home/liuzuocheng/local/mysql datadir = /home/liuzuocheng/var/mysql/data log-error = /home/liuzuocheng/var/mysql/logs/mysql_error.log pid-file = /home/liuzuocheng/var/mysql/mysql.pid user = liuzuocheng
3.回到mysql目录,bin/mysql_install_db --defaults-file=./my.cnf
4.安装db,bin/mysql_install_db --defaults-file=./my.cnf
5.启动db,bin/mysqld_safe --defaults-file=./my.cnf &, 看看tmp/mysql.sock 有这个文件,就启动成功
6.启动客户端,bin/mysql -u root -S ./tmp/mysql.sock