标签:配置 load cte install trap export mcr table als
一、安装依赖软件包2.2安装cmake
[root@www ~]# cdcmake-2.8.8
[root@www cmake-2.8.8]# ./bootstrap
[root@www cmake-2.8.8]# make
[root@www cmake-2.8.8]# make install
2.3安装mysql
下载地址http://mirrors.sohu.com/mysql/MySQL-5.6/
可以使用yum install –y mysql进行安装
还可以使用源码包安装
下载源码包wget mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35.tar.gz
[root@localhost ~]# mkdir -p /mydata/{data,bin-log}
[root@localhost ~]# mkdir -p /etc/mysql
[root@localhost ~]# tar -zxvf mysql-5.6.35.tar.gz
[root@localhost ~]# cd mysql-5.6.35
[root@localhost mysql-5.6.35]# cmake . -DCMAKE_INTALL_PREFIX=/usr/local/mysql/ -DSYSCONFDIR=/etc/mysql/ -DMYSQL_DATADIR=/mydata/data/ -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_OPENSSL=system -DWITH_ZLIB=system -DWITH_LIBWRAp=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
安装成功后:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:85 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.OnDebian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:128 (FIND_CURSES)
cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:421 (MYSQL_CHECK_EDITLINE)
-- Configuring incomplete, errors occurred!
See also "/root/mysql-5.6.31/CMakeFiles/CMakeOutput.log".
See also "/root/mysql-5.6.31/CMakeFiles/CMakeError.log".
[root@www mysql-5.6.31]#
[root@localhost mysql-5.6.35]# make -j grep processor /proc/cpuinfo | wc -l
[root@localhost mysql-5.6.35]# make install
添加mysql组groupadd -r mysql
添加mysql用户useradd -g mysql -r -d /mysqldata/data/ mysql
2.4初始化数据库
2.4.1、修改mysql组和数据目录的属主属组
[root@localhostmysql]# cd /usr/local/mysql/
[root@localhostmysql]# ls
bin data include man README share support-files
COPYING docs lib mysql-test scripts sql-bench
[root@localhostmysql]# chown :mysql ./* -R
[root@localhostmysql]# chown -R mysql:mysql /mydata/data/
[root@localhostmysql]# chown -R mysql:mysql /mydata/bin-log
[root@localhostmysql]#
2.4.2、初始化数据库
[root@localhostmysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
注:--basedir=/usr/local/mysql 可添加此选项也可不添,根据具体情况
[root@localhostmysql]# ls /mydata/data/
ibdata1 ib_logfile0 ib_logfile1 mysqlperformance_schema testbr/>[root@localhostmysql]#
2.4.3、提供服务脚本
[root@localhostmysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhostmysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@localhostmysql]# chkconfig --add mysqldbr/>[root@localhostmysql]#
2.4.4、提供配置文件
[root@wwwmysql]# cp support-files/my-default.cnf /etc/mysql/my.cnf
[root@wwwmysql]# vim /etc/mysql/my.cnf
The MySQL server
[mysqld]
数据库目录地址
datadir = /mydata/data
log_bin = /mydata/bin-log/mysql-bin
Uncomment the following if you are using InnoDB tables
innodb_file_per_table = 1
[mysqld_safe]
open-files-limit = 8192
log-error= /tmp/mysql_error.log
pid-file= /data/mydata/data/iZ2zegql6fupnhn8aei0bgZ.pid
2.4.5、启动mysql服务
[root@localhostmysql]# service mysqld start
[root@localhostmysql]# ss -tnlp | grepmysqld
LISTEN 0 80 :::3306 :::* users:(("mysqld",79297,10))br/>[root@localhostmysql]#
2.4.5、修改环境变量,使mysql命令正常使用,导出man
[root@www bin]# vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin/:$PATH
[root@www bin]# source /etc/profile.d/mysql.sh
[root@zhangmysql]# man -M /usr/local/mysql/man/
2.4.6、删除所有匿名用户
mysql> use mysql;
mysql> select user,host,password from user;
+------+-----------+----------+
| user | host | password |
+------+-----------+----------+
| root | localhost | |
| root | 127.0.0.1 | |
| root | ::1 | |
| | localhost | |
+------+-----------+----------+
4 rows in set (0.01 sec)
mysql> drop user ‘‘@‘localhost‘;
Query OK, 0 rows affected (0.03 sec)
mysql>
2.4.7、给所有root用户设置密码
mysql> update user set password = password(‘zhang‘) where user = ‘root‘;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
标签:配置 load cte install trap export mcr table als
原文地址:http://blog.51cto.com/bosszhang/2135477