(2)解压:
cd /server/tools
tar xf mysql-5.6.36.tar.gz
(3)安装:
cd mysql-5.6.36
# 预定义mysql安装目录、mysql数据存放目录、mysql启动之后产生的socket文件应该存放的目录以及socket文件名称
# 预编译的作用是硬编码一些自定制的配置信息到mysql的各个程序中去
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 \
-DMYSQL_DATADIR=/application/mysql-5.6.36/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0
make && make install
三、配置并启动
(1)制作软连接:
ln -s /application/mysql-5.6.36/ /application/mysql
# 便于后期mysql的升级
(2)拷贝配置文件到/etc:
cp support-files/my*.cnf /etc/my.cnf
(3)初始化数据库(初始化一些元数据):
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
(4)创建关键目录并设置权限:
mkdir -p /application/mysql/tmp
chown -R mysql.mysql /application/mysql/
(5)复制启动脚本到/etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
(6)启动数据库
/etc/init.d/mysqld start
netstat -lntup|grep 330
(7)配置环境变量
echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
mysql # mysql5.6默认是没有密码的
select user,host,password from mysql.user;
排错:
1、输出
2、错误日志
tail -100 /application/mysql/data/db02.err