点击(此处)折叠或打开
- 1、准备
- root@ubuntu:~# groupadd mysql
- root@ubuntu:~# useradd -g mysql mysql
- root@ubuntu:~# apt-get install cmake libncurses5-dev ncurses-devel
- root@ubuntu:~# mkdir /log/mysql -p
- root@ubuntu:~# mkdir /conf/mysql -p
- root@ubuntu:~# mkdir /data/mysql -p
- 2、安装MySQL Server软件
- root@ubuntu:~# cd /usr/local/src/
- root@ubuntu:/usr/local/src# tar -zxvf /root/mysql-5.6.28.tar.gz
- root@ubuntu:/usr/local/src# cd mysql-5.6.28/
- root@ubuntu:/usr/local/src/mysql-5.6.28#cmake . \
- > -DSYSCONFDIR:PATH=/conf/mysql \
- > -DCMAKE_INSTALL_PREFIX:PATH=/server/mysql-5.6.28 \
- > -DMYSQL_DATADIR:PATH=/data/mysql \
- > -DCMAKE_BUILD_TYPE:STRING=Release \
- > -DWITH_DEBUG:BOOL=OFF \
- > -DWITH_VALGRIND:BOOL=OFF \
- > -DENABLE_DEBUG_SYNC:BOOL=OFF \
- > -DWITH_EXTRA_CHARSETS:STRING=all \
- > -DWITH_SSL:STRING=bundled \
- > -DWITH_UNIT_TESTS:BOOL=OFF \
- > -DWITH_ZLIB:STRING=bundled \
- > -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
- > -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
- > -DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \
- > -DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON \
- > -DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
- > -DDEFAULT_CHARSET=utf8 \
- > -DDEFAULT_COLLATION=utf8_bin \
- > -DWITH_EXTRA_CHARSETS=all \
- > -DENABLED_LOCAL_INFILE:BOOL=ON \
- > -DENABLED_PROFILING:BOOL=OFF \
- > -DWITH_EMBEDDED_SERVER=0 \
- > -DINSTALL_LAYOUT:STRING=STANDALONE \
- > -DMYSQL_SERVER_SUFFIX='community'
- root@ubuntu:/usr/local/src/mysql-5.6.28# make&&make install
- 安装数据库,即数据库初始化
- 提示:相关路径在配置文件中指定,配置文件提前准备好的。可以参考/server/mysql-5.6.28/support-files目录下相应模板
- root@ubuntu:/usr/local/src/mysql-5.6.28# cp /root/mysqlTemp.cnf /conf/my.cnf
- root@ubuntu:/usr/local/src/mysql-5.6.28# mkdir /binlog/3306 -p /*binlog文件夹*/
- root@ubuntu:/usr/local/src/mysql-5.6.28# mkdir /data/mysql/3306 -p /*创建数据目录*/
- root@ubuntu:/usr/local/src/mysql-5.6.28# cd /server/mysql-5.6.28
- 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
- root@ubuntu:/server/mysql-5.6.28#./bin/mysqld_safe--defaults-file=/conf/my.cnf --user=mysql&
- [1] 28230
- root@ubuntu:/server/mysql-5.6.28# 160101 02:06:17 mysqld_safe Logging to '/log/mysql/3306error.log'.
- 160101 02:06:17 mysqld_safe Starting mysqld daemon with databases from /data/mysql/3306
- 验证MySQL服务启动
- root@ubuntu:/server/mysql-5.6.28# ss -ntlp|grep mysql
- LISTEN 0 128 :::3306 :::* users:(("mysqld",29465,11))
- root@ubuntu:~# tail -f /log/mysql/3306error.log /*日志文件路径在配置文件中定义*/
- 2016-01-01 02:06:18 29465 [Note] Server hostname (bind-address): '*'; port: 3306
- 2016-01-01 02:06:18 29465 [Note] IPv6 is available.
- 2016-01-01 02:06:18 29465 [Note] - '::' resolves to '::';
- 2016-01-01 02:06:18 29465 [Note] Server socket created on IP: '::'.
- 2016-01-01 02:06:18 29465 [Warning] 'user' entry 'root@ubuntu' ignored in --skip-name-resolve mode.
- 2016-01-01 02:06:18 29465 [Warning] 'user' entry '@ubuntu' ignored in --skip-name-resolve mode.
- 2016-01-01 02:06:18 29465 [Warning] 'proxies_priv' entry '@ root@ubuntu' ignored in --skip-name-resolve mode.
- 2016-01-01 02:06:18 29465 [Note] Event Scheduler: Loaded 0 events
- 2016-01-01 02:06:18 29465 [Note] /server/mysql-5.6.28/bin/mysqld: ready for connections.
- Version: '5.6.28community-log' socket: '/tmp/mysqld.sock' port: 3306 Source distribution