这篇文章主要为大家展示了“mysql 5.6源码如何安装”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“mysql 5.6源码如何安装”这篇文章吧。
创建mysql 用户和用户组
groupadd -g 701 mysql
useradd -g mysql -m mysql -d /home/mysql
mysql目录划分:
mysql软件目录: /mysql/installdir
mysql数据目录:/mysql/datadir/3306/data
mysql日志目录:/mysql/logdir/3306/{bin_log,general_log,error_log,query_log}
mkdir -p /mysql/installdir
mkdir -p /mysql/datadir/3306/data
mkdir -p /mysql/logdir/3306/bin_log
mkdir -p /mysql/logdir/3306/general_log
mkdir -p /mysql/logdir/3306/error_log
mkdir -p /mysql/logdir/3306/query_log
mkdir -p /mysql/installdir
mkdir -p /mysql/datadir/3307/data
mkdir -p /mysql/logdir/3307/bin_log
mkdir -p /mysql/logdir/3307/general_log
mkdir -p /mysql/logdir/3307/error_log
mkdir -p /mysql/logdir/3307/query_log
安装所需要的包:
yum install -y cmake gcc gcc-c++ ncurses-devel bison zlib libxml openssl
编译
cmake \\
-DCMAKE_INSTALL_PREFIX=/mysql/installdir \\
-DINSTALL_DATADIR=/mysql/datadir/3306/data \\
-DDEFAULT_CHARSET=utf8 \\
-DDEFAULT_COLLATION=utf8_general_ci \\
-DEXTRA_CHARSETS=all \\
-DWITH_SSL=yes \\
-DWITH_EMBEDDED_SERVER=1 \\
-DENABLED_LOCAL_INFILE=1 \\
-DWITH_MYISAM_STORAGE_ENGINE=1 \\
-DWITH_INNOBASE_STORAGE_ENGINE=1 \\
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \\
-DWITH_FEDERATED_STORAGE_ENGINE=1 \\
-DWITH_PARTITION_STORAGE_ENGINE=1 \\
-DMYSQL_UNIX_ADDR=/mysql/datadir/3306/data/mysql.sock \\
-DMYSQL_TCP_PORT=3306 \\
-DENABLED_LOCAL_INFILE=1 \\
-DSYSCONFDIR=/etc \\
-DWITH_READLINE=on
安装:
make && make install
实例初始化:
/mysql/installdir/scripts/mysql_install_db –basedir=/mysql/installdir/ –datadir=/mysql/datadir/3306/data –defaults-file=/mysql/datadir/3306/my.cnf
/mysql/installdir/scripts/mysql_install_db –basedir=/mysql/installdir/ –datadir=/mysql/datadir/3307/data –defaults-file=/mysql/datadir/3307/my.cnf
启用mysql实例
./mysqld_safe –defaults-file=/mysql/datadir/3306/my.cnf &
./mysqld_safe –defaults-file=/mysql/datadir/3307/my.cnf &
查看是否启动
ps -ef | grep mysql
修改密码:
use mysql;
UPDATE user SET Password = PASSWORD(‘admin123’) WHERE user = ‘root’;
flush privileges;
多实例登录:
mysql -uroot -padmin123 -S /mysql/datadir/3306/data/mysql.sock
mysql -uroot -padmin123 -S /mysql/datadir/3307/data/mysql.sock
查看实例端口号:
mysql> show variables like ‘port’
-> ;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| port | 3307 |
+—————+——-+
1 row in set (0.00 sec)
以上是“mysql 5.6源码如何安装”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注云搜网行业资讯频道!