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

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

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

2、安装需要的依赖软件

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

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

[root@bogon ~]# tar -xf mysql-5.6..tar.gz -C /usr/local/src/

[root@bogon ~]# cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data \
-DWITH_MYISAM_STORAGE_ENGINE=\
-DWITH_INNOBASE_STORAGE_ENGINE=\
-DWITH_ARCHIVE_STORAGE_ENGINE=\
-DWITH_BLACKHOLE_STORAGE_ENGINE=\
-DWITH_MEMORY_STORAGE_ENGINE= \
-DWITH_READLINE= \
-DENABLED_LOCAL_INFILE=\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DEXTRA_CHARSETS=all\
-DMYSQL_TCP_PORT=\
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock\
-DWITH_DEBUG= \
-DWITH_SSL=system [root@bogon ~]# make && make install

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

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

5、进行安装初始化

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

执行结果:

-- ::  [Note] InnoDB: Shutdown completed; log sequence number
OK Filling help tables...-- :: [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
-- :: [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
-- :: [Note] /usr/local/mysql//bin/mysqld (mysqld 5.6.37) starting as process 37140 ...
-- :: [Note] InnoDB: Using atomics to ref count buffer pool pages
-- :: [Note] InnoDB: The InnoDB memory heap is disabled
-- :: [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
-- :: [Note] InnoDB: Memory barrier is not used
-- :: [Note] InnoDB: Compressed tables use zlib 1.2.
-- :: [Note] InnoDB: Using CPU crc32 instructions
-- :: [Note] InnoDB: Initializing buffer pool, size = 128.0M
-- :: [Note] InnoDB: Completed initialization of buffer pool
-- :: [Note] InnoDB: Highest supported file format is Barracuda.
-- :: [Note] InnoDB: rollback segment(s) are active.
-- :: [Note] InnoDB: Waiting for purge to start
-- :: [Note] InnoDB: 5.6. started; log sequence number
-- :: [Note] RSA private key file not found: /data//private_key.pem. Some authentication plugins will not work.
-- :: [Note] RSA public key file not found: /data//public_key.pem. Some authentication plugins will not work.
-- :: [Note] Binlog end
-- :: [Note] InnoDB: FTS optimize thread exiting.
-- :: [Note] InnoDB: Starting shutdown...
-- :: [Note] InnoDB: Shutdown completed; log sequence number
OK
其中出现两个ok是成功的。

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

初始化之后的说明:
New default config file was created as /usr/local/mysql//my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings 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 配置文件的问题。
[root@bogon scripts]# mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
[root@bogon scripts]# ps -aux | grep -v grep | grep mysql
root 0.0 0.1 pts/ S : : /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf
mysql 0.7 44.8 pts/ Sl : : /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的用户的密码修改。

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

8、停止mysql的服务

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

9、错误

编译错误删除

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

最新文章

  1. [LeetCode] Candy 分糖果问题
  2. nodejs+express+jade配置
  3. Sql助手
  4. buffer overflow vulnerabilitie
  5. TIFF6 Packbit algorithm
  6. java的动态绑定与双分派(规避instanceof)
  7. JavaScript Book Plan
  8. linux防火墙基本操作
  9. Good Bye 2017 E. New Year and Entity Enumeration
  10. 自制操作系统Antz(15)——实现启动界面
  11. DAY 17常用模块
  12. Failed to load bundle(http://loaclhost:8081/index.bundle?platfrom=ios.....
  13. Xshell连接不上Linux
  14. MySQL8.0初体验
  15. T4模板_入门
  16. android 使用 sqlite
  17. poj_3436 网络最大流
  18. java性能分析工具 jconsole.exe
  19. 微信小程序开发(三)项目目录及文件结构
  20. Redis配置文件的使用

热门文章

  1. 原来TextBox打开了MultiLine之后就不能使用AutoComplete了
  2. AtCoder Beginner Contest 054 ABCD题
  3. 15 使用lambdas和闭包
  4. 牛客网Java刷题知识点之调用线程类的start()方法和run()方法的区别
  5. spring security 5 There is no PasswordEncoder mapped for the id "null" 错误
  6. java 并发容器一之BoundedConcurrentHashMap(基于JDK1.8)
  7. Monkey安装和使用介绍
  8. LR中测试dubbo接口的脚本
  9. hihoCoder #1151 : 骨牌覆盖问题·二 (矩阵快速幂,DP)
  10. mongo ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused