编译前安装准备OS:Centos 6.9Mysql:5.7.18下载mysql源官网源:mysql-boost mysql搜狐源:mysql-boost mysql安装Mysql之前卸载原有的版本
编译前安装准备
OS:Centos 6.9
Mysql:5.7.18
下载mysql源
官网源:mysql-boost mysql
搜狐源:mysql-boost mysql
安装Mysql之前卸载原有的版本
查询Mysql目录文件 卸载原有MySQL
# rpm -qa | grep mysql
# find / -name mysql
# yum remove -y mysql-libs-5.1.73-3.el6_5.x86_64
安装编译环境
# yum -y install make wget GCc-c++ cmake bison-devel ncurses-devel
Preconfiguration setup
# groupadd mysql
# useradd -r -g mysql -s /bin/false mysql
Beginning of source-build specific instructions
# mkdir ~/mysql && cd ~/mysql
# mkdir -p /data/mysql_data
# wget -c https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz
# tar -zxvf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18/
# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql_data \
-DSYSCONFDIR=/etc \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DWITH_ARCHive_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_tcp_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# make
# make install
End of source-build specific instructions
Postinstallation setup
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
Before MySQL 5.7.6
# bin/mysql_install_db --user=mysql
MySQL 5.7.6 and up
# bin/mysqld --initialize --user=mysql
# bin/mysql_ssl_rsa_setup
# chown -R root .
# chown -R mysql /data
# bin/mysqld_safe --user=mysql &
配置开机启动项
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
# chmod +x /etc/init.d/mysql.server
# chkconfig --add mysql.server
# chkconfig mysql.server on
配置/etc/my.cnf 仅供参考,可以不配用默认的。
启动mysql
# service mysql.server start
加入开机启动项
# chkconfig --live 35 mysql.server on
查看端口是否被占用
# netstat -tulnp | grep 3306
查看数据库版本
# ln -s /usr/local/mysql/bin/mysql /usr/bin/
# mysql --version
登入数据库
# mysql -u root -p
查看数据库
>show databases;
重设密码,这里密码设置为?root?
>set passWord = password('?root?');
退出数据库
>exit;
--结束END--
本文标题: 使用标准源分发安装MySQL
本文链接: https://lsjlt.com/news/39701.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0