Centos6.6安装通用二进制版mysql5.6.38
2017-12-04 20:28
148 查看
安装过程中的命令
[root@host3 mysql_5.6.38]# groupadd mysql #创建用户组 [root@host3 mysql_5.6.38]# useradd -r -g mysql -s /bin/false mysql #创建用户mysql且指定组为mysql [root@host3 mysql_5.6.38]# tar -zxvf mysql-5.6.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ #解压文件至/usr/local目录下 [root@host3 mysql_5.6.38]# mv mysql-5.6.38-linux-glibc2.12-x86_64/ mysql_5.6.38 #重命名 [root@host3 mysql_5.6.38]# cd /usr/local/mysql_5.6.38 #进入安装目录 [root@host3 mysql_5.6.38]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql_5.6.38 --datadir=/data/mysql #运行安装数据库脚本,perl脚本. [root@host3 mysql_5.6.38]# bin/mysqld_safe --user=mysql & # Next command is optional [root@host3 mysql_5.6.38]# vi support-files/mysql.server #修改basedir和datadir的值为安装时的设定值,若安装目录为/usr/local/mysql则不需要修改,系统模式数据放在/var/lib/mysql目录 [root@host3 mysql_5.6.38]# cp support-files/mysql.server /etc/init.d/mysql #拷贝至可用于service 启动,文件名就是server后面的服务 [root@host3 mysql_5.6.38]# service mysql start #启动服务器 [root@host3 mysql_5.6.38]# ./bin/mysqladmin -u root password '123456' #设置密码为123456
安装之后的服务器默认是空密码,即无密码
操作系统信息
[root@host3 mysql_5.6.38]# cat /proc/version Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014 [root@host3 mysql_5.6.38]# cat /etc/issue CentOS release 6.6 (Final) Kernel \r on an \m
安装过程中遇到的问题
没有安装perl
[root@host3 scripts]# ./mysql_install_db –user=mysql-bash: ./mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory
[root@host3 scripts]# yum -y install perl perl-devel
找不到libnuma.so.1库,因为是64位系统,故安装numactl.x86_64
[root@host3 mysql_5.6.38]# ./scripts/mysql_install_db –user=mysqlInstalling MySQL system tables…./bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
Answer:
yum -y install numactl.x86_64
安装的实际过程输出
mysql服务安装过程,该阶段必须要有my.cnf文件指定mysql数据的存储位置,否则会将数据文件默认安装到/var/lib/mysql目录[root@host3 mysql_5.6.38]# ./scripts/mysql_install_db --user=mysql Installing MySQL system tables...2017-12-01 10:39:39 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-12-01 10:39:39 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-12-01 10:39:39 0 [Note] ./bin/mysqld (mysqld 5.6.38) starting as process 3203 ... 2017-12-01 10:39:39 32 4000 03 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-12-01 10:39:39 3203 [Note] InnoDB: The InnoDB memory heap is disabled 2017-12-01 10:39:39 3203 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-12-01 10:39:39 3203 [Note] InnoDB: Memory barrier is not used 2017-12-01 10:39:39 3203 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-12-01 10:39:39 3203 [Note] InnoDB: Using Linux native AIO 2017-12-01 10:39:39 3203 [Note] InnoDB: Using CPU crc32 instructions 2017-12-01 10:39:39 3203 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-12-01 10:39:39 3203 [Note] InnoDB: Completed initialization of buffer pool 2017-12-01 10:39:39 3203 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2017-12-01 10:39:39 3203 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2017-12-01 10:39:39 3203 [Note] InnoDB: Database physically writes the file full: wait... 2017-12-01 10:39:39 3203 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2017-12-01 10:39:40 3203 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2017-12-01 10:39:42 3203 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2017-12-01 10:39:42 3203 [Warning] InnoDB: New log files created, LSN=45781 2017-12-01 10:39:42 3203 [Note] InnoDB: Doublewrite buffer not found: creating new 2017-12-01 10:39:42 3203 [Note] InnoDB: Doublewrite buffer created 2017-12-01 10:39:42 3203 [Note] InnoDB: 128 rollback segment(s) are active. 2017-12-01 10:39:42 3203 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-12-01 10:39:42 3203 [Note] InnoDB: Foreign key constraint system tables created 2017-12-01 10:39:42 3203 [Note] InnoDB: Creating tablespace and datafile system tables. 2017-12-01 10:39:42 3203 [Note] InnoDB: Tablespace and datafile system tables created. 2017-12-01 10:39:42 3203 [Note] InnoDB: Waiting for purge to start 2017-12-01 10:39:42 3203 [Note] InnoDB: 5.6.38 started; log sequence number 0 2017-12-01 10:39:44 3203 [Note] Binlog end 2017-12-01 10:39:44 3203 [Note] InnoDB: FTS optimize thread exiting. 2017-12-01 10:39:44 3203 [Note] InnoDB: Starting shutdown... 2017-12-01 10:39:45 3203 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK Filling help tables...2017-12-01 10:39:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-12-01 10:39:45 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-12-01 10:39:45 0 [Note] ./bin/mysqld (mysqld 5.6.38) starting as process 3225 ... 2017-12-01 10:39:45 3225 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-12-01 10:39:45 3225 [Note] InnoDB: The InnoDB memory heap is disabled 2017-12-01 10:39:45 3225 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-12-01 10:39:45 3225 [Note] InnoDB: Memory barrier is not used 2017-12-01 10:39:45 3225 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-12-01 10:39:45 3225 [Note] InnoDB: Using Linux native AIO 2017-12-01 10:39:45 3225 [Note] InnoDB: Using CPU crc32 instructions 2017-12-01 10:39:45 3225 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-12-01 10:39:45 3225 [Note] InnoDB: Completed initialization of buffer pool 2017-12-01 10:39:45 3225 [Note] InnoDB: Highest supported file format is Barracuda. 2017-12-01 10:39:45 3225 [Note] InnoDB: 128 rollback segment(s) are active. 2017-12-01 10:39:45 3225 [Note] InnoDB: Waiting for purge to start 2017-12-01 10:39:45 3225 [Note] InnoDB: 5.6.38 started; log sequence number 1625977 2017-12-01 10:39:45 3225 [Note] Binlog end 2017-12-01 10:39:45 3225 [Note] InnoDB: FTS optimize thread exiting. 2017-12-01 10:39:45 3225 [Note] InnoDB: Starting shutdown... 2017-12-01 10:39:47 3225 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h host3 password 'new-password' Alternatively you can run: ./bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com WARNING: Found existing config file ./my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as ./my-new.cnf, please compare it with your file and take the changes you need. WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
mysqld_safe运行输出
[root@host3 mysql_5.6.38]# ./bin/mysqld_safe --user=mysql & [1] 3334 [root@host3 mysql_5.6.38]# 171201 10:51:14 mysqld_safe Logging to '/var/log/mysqld.log'. 171201 10:51:14 mysqld_safe Starting mysqld daemon with databases from /data/mysql 171201 10:51:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended [1]+ Done ./bin/mysqld_safe --user=mysql
默认配置文件/etc/my.cnf
[root@host3 mysql_5.6.38]# ll /etc/my.cnf -rw-r--r--. 1 root root 251 Feb 13 2014 /etc/my.cnf [root@host3 mysql_5.6.38]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
配置文件my.cnf
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html [client] port=3306 socket=/tmp/mysql.sock default-character-set=utf8 [mysqld] port=3306 socket=/tmp/mysql.sock key_buffer_size=16M max_allowed_packet=8M basedir=/usr/local/mysql_5.6.38 datadir=/data/mysql #binary logging log-bin=mysql-bin binlog-format=Row character-set-server=utf8 default-storage-engine=INNODB [mysqldump] quick sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
参考文档
二进制安装服务配置
服务默认配置
可选配置项
设置密码
相关文章推荐
- Linux下通用二进制安装包安装MySQL-5.7.17
- 通用二进制格式安装mysql
- 通用二进制格式编译安装mysql
- mysql之通用二进制格式程序包安装
- mysql5.6.13通用二进制格式安装并使用amoeba实现对mysql5.6数据库读写分离
- mysql(5.6.38)绿色版安装(CentOS7)
- 模拟生成环境的MySQL安装方法-通用二进制方式安装
- 使用通用二进制安装mysql
- lamp环境搭建之二mysql通用二进制安装
- mysql通用二进制格式安装
- MySQL 5.5 通用二进制格式安装
- 安装mysql,通用二进制模式安装
- MySQL通用二进制文件在Unix / Linux上安装MySQL
- 非root用户安装mysql-5.6.38.tar.gz
- mysql 5.6.38 安装(redhat 6)
- mysql 5.6.38 数据库编译安装
- Centos7.4 安装MySQL 5.7.21 (通用二进制包)
- mysql最新通用二进制分发版本5.7.16自动安装shell脚本
- mysql 5.6.38 安装(redhat 6)
- 编译安装LAMP之MySQL-5.5.52(通用二进制格式)