当前位置:Gxlcms > 数据库问题 > 使用标准源分发安装MySQL

使用标准源分发安装MySQL

时间:2021-07-01 10:21:17 帮助过:6人阅读

# 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;


本文出自 “耐心是美德” 博客,请务必保留此出处http://1550349.blog.51cto.com/1540349/1932470

使用标准源分发安装MySQL

标签:mysql install

人气教程排行