1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > linux上源码编译安装mysql-5.6.28

linux上源码编译安装mysql-5.6.28

时间:2024-04-25 22:07:13

相关推荐

linux上源码编译安装mysql-5.6.28

在 linux 上编译安装 mysql-5.6.28.tar.gz/mysql下载地址:/downloads/mysql/#downloadsmysql 官方网站文档:/doc/01、准备工作yum install-y gcc gcc-c++ cmake make ncurses ncurses-devel bison02、解压tar zxf mysql-5.6.28.tar.gz03、编译cmake . \-DCMAKE_INSTALL_PREFIX=/tmp/test/mysql \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_EXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_cimake-j 8make install -j 8注意:常见的CMAKE选项-DCMAKE_INSTALL_PREFIX=/usr/local/mysql MySQL安装目录-DWITH_INNOBASE_STORAGE_ENGINE=1 安装InnoDB存储引擎-DWITH_MYISAM_STORAGE_ENGINE=1 安装MyISAM存储引擎-DWITH_MEMORY_STORAGE_ENGINE=1 安装内存存储引擎-DDEFAULT_CHARSET=utf8 默认编码设置成utf8-DDEFAULT_COLLATION=utf8_general_ci 默然校验规则是utf8_general_ci-DWITH_EXTRA_CHARSETS=all 支持其他所有的编码-DMYSQL_TCP_PORT=3306 MySQL端口指定为3306-DMYSQL_UNIX_ADDR=/tmp/mysql.sock指定SOCK文件路径-DMYSQL_DATADIR=/usr/local/mysql/dataMySQL数据目录make-j n 支持多线程编译(一般跟内核数相等)04、配置f[root@rhel mysql]# pwd/tmp/test/mysqlmkdir conf cp support-files/my-f conf/vim f详情看下面的附属

05、初始化数据库useradd mysql#注意 --user 需要用root编译./scripts/mysql_install_db --defaults-file=/tmp/test/mysql/f --user=mysql./scripts/mysql_install_db --defaults-extra-file=/tmp/test/mysql/conf/f --user=mysql06、启动数据库./bin/mysqld_safe --defaults-file=/tmp/test/mysql/f --user=mysql &./bin/mysqld_safe --defaults-extra-file=/tmp/test/mysql/conf/f --user=mysql &07、设置密码[root@rhel ~]# ss -ln |grep 3333LISTEN080 :::3333:::* ./bin/mysqladmin -u root password '123123'08、账户授权grant all on *.* to 'mvpbang'@'%' identified by '123123';flush privileges;09、设置系统环境变量vim /etc/profileexport PATH=$PATH://tmp/test/mysql/binsource /etc/profile修改 rc.local ,让 mysql 开机自动运行echo "mysqld_safe --defaults-extra-file=/tmp/test/mysql/conf/f --user=mysql &" >>/etc/rc.local10、基本命令的参数说明[root@rhel mysql]# ./scripts/mysql_install_db --helpUsage: ./scripts/mysql_install_db [OPTIONS]--basedir=path The path to the MySQL installation directory.--builddir=pathIf using --srcdir with out-of-directory builds, youwill need to set this to the location of the builddirectory where built files reside.--cross-bootstrap For internal use. Used when building the MySQL systemtables on a different host than the target.--datadir=path The path to the MySQL data directory.If missing, the directory will be created, but itsparent directory must already exist and be writable.--defaults-extra-file=nameRead this file after the global files are read.--defaults-file=name Only read default options from the given file name.--force Causes mysql_install_db to run even if DNS does notwork. In that case, grant table entries thatnormally use hostnames will use IP addresses.--helpDisplay this help and exit. --ldata=path The path to the MySQL data directory. Same as --datadir.--no-defaults Don't read default options from any option file.--keep-my-cnf Don't try to create f based on template. Useful for systems with working, updated f.Deprecated, will be removed in future version.--random-passwords Create and set a random password for all root accountsand set the "password expired" flag,also remove the anonymous accounts.--rpmFor internal use. This option is used by RPM filesduring the MySQL installation process.--skip-name-resolve Use IP addresses rather than hostnames when creatinggrant table entries. This option can be useful ifyour DNS does not work.--srcdir=path The path to the MySQL source directory. This optionuses the compiled binaries and support files within thesource tree, useful for if you don't want to install MySQL yet and just want to create the system tables.--user=user_nameThe login username to use for running mysqld. Filesand directories created by mysqld will be owned by thisuser. You must be root to use this option. By defaultmysqld runs using your current login name and files anddirectories that it creates will be owned by you.Any other options are passed to the mysqld program.[root@rhel mysql]# ./bin/mysqld_safe --helpUsage: ./bin/mysqld_safe [OPTIONS]--no-defaults Don't read the system defaults file--defaults-file=FILE Use the specified defaults file--defaults-extra-file=FILE Also use defaults from the specified file--ledir=DIRECTORYLook for mysqld in the specified directory--open-files-limit=LIMIT Limit the number of open files--core-file-size=LIMITLimit core files to the specified size--timezone=TZ Set the system timezone--malloc-lib=LIB Preload shared library LIB if available--mysqld=FILE Use the specified file as mysqld--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld--nice=NICESet the scheduling priority of mysqld--plugin-dir=DIR Plugins are under DIR or DIR/VERSION, ifVERSION is given--skip-kill-mysqld Don't try to kill stray mysqld processes--syslog Log messages to syslog with 'logger'--skip-syslog Log messages to error log (default)--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'All other options are passed to the mysqld program.

附上f

[client]default-character-set=utf8[mysql]auto-rehashdefault-character-set=utf8[mysqld]#根据实际情况适当调整innodb_buffer_pool_size = 128Mjoin_buffer_size = 128Msort_buffer_size = 2Mread_rnd_buffer_size = 2M #个性化设置lower_case_table_names=1 #忽略大小写#对大批量数据导入导出防止超时max_allowed_packet=500Mwait_timeout=200000interactive_timeout=200000#数据库字符集设置(由于编译已经选择,顾不需要设置)#init_connect='SET collation_connection = utf8_unicode_ci'#init_connect='SET NAMES utf8'#character-set-server=utf8#collation-server=utf8_unicode_ci#日志记录#log_bin#基本信息basedir = /tmp/test/mysqldatadir = /tmp/test/mysql/dataport = 3333server_id = 1socket = /tmp/test/mysql/data/mysql.socksql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqld_safe]log-error = /tmp/test/mysql/life.logpid-file = /tmp/test/mysql/data/mysqld.pid

内核编译进度

注意:配置低的编译基本上都是1个小时左右!!!(一般建议放在服务器上编译开多线程)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。