今天要完成一培训作业,其中有一环节要准备MySQL环境,还让给截图写过程,无奈之余还琢磨点新花样,得了,干脆去Ubuntu环境下安装吧,以前还真没装过......此处省略点文字

点击(此处)折叠或打开

  1. 1、准备
  2. root@ubuntu:~# groupadd mysql
  3. root@ubuntu:~# useradd -g mysql mysql
  4. root@ubuntu:~# apt-get install cmake libncurses5-dev ncurses-devel
  5. root@ubuntu:~# mkdir /log/mysql -p
  6. root@ubuntu:~# mkdir /conf/mysql -p
  7. root@ubuntu:~# mkdir /data/mysql -p
  8. 2、安装MySQL Server软件
  9. root@ubuntu:~# cd /usr/local/src/
  10. root@ubuntu:/usr/local/src# tar -zxvf /root/mysql-5.6.28.tar.gz
  11. root@ubuntu:/usr/local/src# cd mysql-5.6.28/
  12. root@ubuntu:/usr/local/src/mysql-5.6.28#cmake . \
  13. > -DSYSCONFDIR:PATH=/conf/mysql \
  14. > -DCMAKE_INSTALL_PREFIX:PATH=/server/mysql-5.6.28 \
  15. > -DMYSQL_DATADIR:PATH=/data/mysql \
  16. > -DCMAKE_BUILD_TYPE:STRING=Release \
  17. > -DWITH_DEBUG:BOOL=OFF \
  18. > -DWITH_VALGRIND:BOOL=OFF \
  19. > -DENABLE_DEBUG_SYNC:BOOL=OFF \
  20. > -DWITH_EXTRA_CHARSETS:STRING=all \
  21. > -DWITH_SSL:STRING=bundled \
  22. > -DWITH_UNIT_TESTS:BOOL=OFF \
  23. > -DWITH_ZLIB:STRING=bundled \
  24. > -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
  25. > -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
  26. > -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \
  27. > -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
  28. > -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
  29. > -DDEFAULT_CHARSET=utf8 \
  30. > -DDEFAULT_COLLATION=utf8_bin \
  31. > -DWITH_EXTRA_CHARSETS=all \
  32. > -DENABLED_LOCAL_INFILE:BOOL=ON \
  33. > -DENABLED_PROFILING:BOOL=OFF \
  34. > -DWITH_EMBEDDED_SERVER=0 \
  35. > -DINSTALL_LAYOUT:STRING=STANDALONE \
  36. > -DMYSQL_SERVER_SUFFIX='community'
  37. root@ubuntu:/usr/local/src/mysql-5.6.28# make&&make install
  38. 安装数据库,即数据库初始化
  39. 提示:相关路径在配置文件中指定,配置文件提前准备好的。可以参考/server/mysql-5.6.28/support-files目录下相应模板
  40. root@ubuntu:/usr/local/src/mysql-5.6.28# cp /root/mysqlTemp.cnf /conf/my.cnf
  41. root@ubuntu:/usr/local/src/mysql-5.6.28# mkdir /binlog/3306 -p /*binlog文件夹*/
  42. root@ubuntu:/usr/local/src/mysql-5.6.28# mkdir /data/mysql/3306 -p /*创建数据目录*/
  43. root@ubuntu:/usr/local/src/mysql-5.6.28# cd /server/mysql-5.6.28
  44. root@ubuntu:/server/mysql-5.6.28#./scripts/mysql_install_db --defaults-file=/conf/my.cnf --basedir=/server/mysql-5.6.28 --datadir=/data/mysql/3306
  45. root@ubuntu:/server/mysql-5.6.28#./bin/mysqld_safe--defaults-file=/conf/my.cnf --user=mysql&
  46. [1] 28230
  47. root@ubuntu:/server/mysql-5.6.28# 160101 02:06:17 mysqld_safe Logging to '/log/mysql/3306error.log'.
  48. 160101 02:06:17 mysqld_safe Starting mysqld daemon with databases from /data/mysql/3306
  49. 验证MySQL服务启动
  50. root@ubuntu:/server/mysql-5.6.28# ss -ntlp|grep mysql
  51. LISTEN 0 128 :::3306 :::* users:(("mysqld",29465,11))
  52. root@ubuntu:~# tail -f /log/mysql/3306error.log /*日志文件路径在配置文件中定义*/
  53. 2016-01-01 02:06:18 29465 [Note] Server hostname (bind-address): '*'; port: 3306
  54. 2016-01-01 02:06:18 29465 [Note] IPv6 is available.
  55. 2016-01-01 02:06:18 29465 [Note] - '::' resolves to '::';
  56. 2016-01-01 02:06:18 29465 [Note] Server socket created on IP: '::'.
  57. 2016-01-01 02:06:18 29465 [Warning] 'user' entry 'root@ubuntu' ignored in --skip-name-resolve mode.
  58. 2016-01-01 02:06:18 29465 [Warning] 'user' entry '@ubuntu' ignored in --skip-name-resolve mode.
  59. 2016-01-01 02:06:18 29465 [Warning] 'proxies_priv' entry '@ root@ubuntu' ignored in --skip-name-resolve mode.
  60. 2016-01-01 02:06:18 29465 [Note] Event Scheduler: Loaded 0 events
  61. 2016-01-01 02:06:18 29465 [Note] /server/mysql-5.6.28/bin/mysqld: ready for connections.
  62. Version: '5.6.28community-log' socket: '/tmp/mysqld.sock' port: 3306 Source distribution


11-24 22:53