时间:2021-07-01 10:21:17 帮助过:3人阅读
4.bison程序包。下载地址 http://www.gnu.org/software/bison/
# tar -xvf bison-3.0.tar.gz # mv bison-3.0 bison # mv bison /tmp # cd /tmp/bison/ # ./cofigure # make # make install # bison --version
5.如果想运行test scripts,还需要安装perl
创建mysql用户:
# /usr/sbin/groupadd mysql
# /usr/sbin/useradd -g mysql mysql
编译安装:
# tar -xvf mysql-5.5.44.tar.gz # cd mysql-5.5.44 # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_DATADIR=/var/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DSYSCONFDIR=/etc # make # make install
cmke参数补充说明:
#mysql安装的主目录,版本默认为/usr/local/mysql -DCMAKE_INSTALL_PREFIX=/usr/local/mysql #mysql数据保存的路径,自定义 -DMYSQL_DATADIR=/var/mysql/data #mysql配置文件地址------The default my.cnf option file directory -DSYSCONFDIR=/etc #Compile storage engine xxx statically into server #Storage engines are built as plugins. You can build a plugin as a static module (compiled into the server) #or a dynamic module (built as a dynamic library that must be installed into the server using the INSTALL #PLUGIN statement or the --plugin-load option before it can be used). Some plugins might not support static #or dynamic building. -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 #Unix socket file #The Unix socket file path on which the server listens for socket connections. This must be an absolute path #name. The default is /tmp/mysql.sock -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock #数据库服务器TCP/IP连接的监听端口,默认为3306 -DMYSQL_TCP_PORT=3306 #Whether to enable LOCAL capability in the client library for LOAD DATA INFILE #默认为关闭,这里开启 -DENABLED_LOCAL_INFILE=1 #数据库编码设置 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8-general_ci
一些相关设置
# mkdir -p /var/mysql/ # mkdir -p /var/mysql/data/ # mkdir -p /var/mysql/log/ # chown -R mysql:mysql /var/mysql/ # cd support-files/ # cp my-medium.cnf /etc/my.cnf (注意:my-large.cnf适用于1G内存左右的服务器,可以根据自己配置情况选用my-large.cnf 、my-medium.cnf或 my-huge.cnf 等不同配置) #vi /etc/my.cnf(编辑此文件,查找并修改以下变量内容:) basedir=/usr/local/mysql datadir=/var/mysql/data
mysql 初始化:
$ cd /usr/local/mysql/scripts # 利用mysql_install_db脚本生成新的MySQL授权表 $ cd /usr/local/mysql/support-files /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/var/mysql/data --user=mysql
将 mysql添加到服务,并配置开机启动:
# cp mysql.server /etc/init.d/mysqld # chmod +x /etc/init.d/mysqld # chkconfig --add mysqld # chkconfig --level 345 mysqld on
启动服务:
# service mysqld start
MySQL源码安装
标签: