经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库运维 » MySQL » 查看文章
centos7 中安装 mysql5.6 的过程
来源:cnblogs  作者:爱的小屋  时间:2018/10/11 9:16:13  对本文有异议

前提是Centos的环境是好的,并且相关的软件包已经安装好。

1、创建用户,并修改创建的数据目录的属主

  1. [root@bogon ~]# useradd -M mysql -s /sbin/nologin
  2. [root@bogon ~]# mkdir /data
  3. [root@bogon ~]# chown -R mysql:mysql /data/

2、安装需要的依赖软件

  1. [root@bogon ~]# yum -y install gcc gcc-c++ cmake ncurses-devel perl-Data-dumper openssl-devel

3、上传源码包,并解压安装

  1. [root@bogon ~]# tar -xf mysql-5.6.37.tar.gz -C /usr/local/src/
  2. [root@bogon ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data -DWITH_MYISAM_STORAGE_ENGINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DEXTRA_CHARSETS=all-DMYSQL_TCP_PORT=3306-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock-DWITH_DEBUG=0 -DWITH_SSL=system
  3. [root@bogon ~]# make && make install

4、进行简单的配置文件的配置

  1. [root@bogon etc]# rm -rf my.cnf.d/
  2. [root@bogon support-files]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

5、进行安装初始化

  1. [root@bogon scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/

      执行结果:

  1. 2018-10-09 22:39:03 37118 [Note] InnoDB: Shutdown completed; log sequence number 1625977
  2. OK
  3. Filling help tables...2018-10-09 22:39:03 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  4. 2018-10-09 22:39:03 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
  5. 2018-10-09 22:39:03 0 [Note] /usr/local/mysql//bin/mysqld (mysqld 5.6.37) starting as process 37140 ...
  6. 2018-10-09 22:39:03 37140 [Note] InnoDB: Using atomics to ref count buffer pool pages
  7. 2018-10-09 22:39:03 37140 [Note] InnoDB: The InnoDB memory heap is disabled
  8. 2018-10-09 22:39:03 37140 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  9. 2018-10-09 22:39:03 37140 [Note] InnoDB: Memory barrier is not used
  10. 2018-10-09 22:39:03 37140 [Note] InnoDB: Compressed tables use zlib 1.2.3
  11. 2018-10-09 22:39:03 37140 [Note] InnoDB: Using CPU crc32 instructions
  12. 2018-10-09 22:39:03 37140 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  13. 2018-10-09 22:39:03 37140 [Note] InnoDB: Completed initialization of buffer pool
  14. 2018-10-09 22:39:03 37140 [Note] InnoDB: Highest supported file format is Barracuda.
  15. 2018-10-09 22:39:03 37140 [Note] InnoDB: 128 rollback segment(s) are active.
  16. 2018-10-09 22:39:03 37140 [Note] InnoDB: Waiting for purge to start
  17. 2018-10-09 22:39:03 37140 [Note] InnoDB: 5.6.37 started; log sequence number 1625977
  18. 2018-10-09 22:39:03 37140 [Note] RSA private key file not found: /data//private_key.pem. Some authentication plugins will not work.
  19. 2018-10-09 22:39:03 37140 [Note] RSA public key file not found: /data//public_key.pem. Some authentication plugins will not work.
  20. 2018-10-09 22:39:03 37140 [Note] Binlog end
  21. 2018-10-09 22:39:03 37140 [Note] InnoDB: FTS optimize thread exiting.
  22. 2018-10-09 22:39:03 37140 [Note] InnoDB: Starting shutdown...
  23. 2018-10-09 22:39:04 37140 [Note] InnoDB: Shutdown completed; log sequence number 1625987
  24. OK
  25. 其中出现两个ok是成功的。

6、启动mysql,并把相关命令添加到环境变量中

  1. 初始化之后的说明:
    New default config file was created as /usr/local/mysql//my.cnf and
  2. will be used by default by the server when you start it.
  3. You may edit this file to change server settings
  4. WARNING: Default config file /etc/my.cnf exists on the system
  5. This file will be read by default by the MySQL server
  6. If you do not want to use this, either remove it, or use the
  7. --defaults-file argument to mysqld_safe when starting the server
  8. 配置文件的问题。
  9. [root@bogon scripts]# mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
  10. [root@bogon scripts]# ps -aux | grep -v grep | grep mysql
  11. root 37183 0.0 0.1 113308 1620 pts/0 S 22:46 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf
  12. mysql 37252 0.7 44.8 1325772 449480 pts/0 Sl 22:46 0:01 /usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/my.cnf --basedir=/usr/local/mysql --datadir=/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=bogon.err --pid-file=bogon.pid

 7、进行简单的mysql的用户的密码修改。

  1. [root@bogon bin]# mysql -u root
  2. mysql> use mysql;
  3. mysql> update user set password=PASSWORD("111111") where User='root';
  4. mysql> flush privileges;

8、停止mysql的服务

  1. [root@bogon bin]# mysqladmin -uroot -p shutdown

9、错误

编译错误删除

  1. [root@bogon mysql-5.6.37]# rm -rf CMakeCache.txt

 

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号