MySQL的源码安装流程

软件包提取码:dfmp
mysql安装过程

[root@CentOS1 ~]# yum -y install bison cmake ncurses-devel openssl-devel
[root@CentOS1 ~]# tar zxf mysql-5.6.36.tar.gz 
[root@CentOS1 ~]# cd mysql-5.6.36/
[root@CentOS1 mysql-5.6.36]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHASETS=all
[root@CentOS1 mysql-5.6.36]# make && make install
[root@localhost mysql-5.6.46]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib
[root@localhost mysql-5.6.46]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@localhost mysql-5.6.46]# useradd -M -s /sbin/nologin mysql
[root@localhost mysql-5.6.46]# chown -R mysql:mysql /usr/local/mysql/
[root@localhost mysql-5.6.46]# pwd
/root/mysql-5.6.46
[root@localhost mysql-5.6.46]# cd support-files/
[root@localhost support-files]# cp my-default.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
[root@localhost support-files]# cp mysql.server /etc/init.d/mysqld
[root@localhost support-files]# vim /etc/init.d/mysqld 
 46 basedir=/usr/local/mysql  #mysql安装路径
 47 datadir=/usr/local/mysql/data #数据存放目录
[root@localhost support-files]# chmod +x /etc/init.d/mysqld
[root@localhost support-files]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
[root@localhost support-files]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
. SUCCESS! 
[root@localhost support-files]# netstat -anput | grep LISTEN | grep 3306
tcp6       0      0 :::3306                 :::*                    LISTEN      24121/mysqld 

[root@localhost support-files]# mysqladmin -uroot password 123.com
Warning: Using a password on the command line interface can be insecure.

[root@localhost support-files]# mysql -uroot -p123.com

你可能感兴趣的:(MySQL的源码安装流程)