Win10 子系统 WSL 编译安装MySQL5.7
Posted 八千岁将军
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Win10 子系统 WSL 编译安装MySQL5.7相关的知识,希望对你有一定的参考价值。
---恢复内容开始---
在win10 商店中选择 ubuntu18.04
下载地址
http://dev.mysql.com/downloads/mysql/
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.23.tar.gz
tar -zvxf mysql-boost-5.7.23.tar.gz
cd mysql-5.7.23
sudo apt-get install cmake -y
sudo apt-get install gcc g++ -y
apt-get install git -y
apt-get install libncurses5 libncurses5-dev -y
sudo apt-get install -y build-essential
sudo apt-get install flex bison -y
安装boost 1.59 https://sourceforge.net/projects/boost/
wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
下载过程有些慢,我用的迅雷下载的,速度非常快
sudo apt-get install mpi-default-dev libicu-dev python-dev libbz2-dev -y
cd boost_1_59_0
./bootstrapsh
./b2 -a -sHAVE_ICU=1 # the parameter means that it support icu or unicode
sudo ./b2 install
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLE_DOWNLOADS=1
如果出现错误,再次编译的时候需要删除CMakeCache.txt文件
groupadd mysql
useradd -g mysql mysql
mkdir /usr/local/mysql/data
chown -R mysql /usr/local/mysql
chgrp -R mysql /usr/local/mysql
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
记下生成的密码
/usr/local/mysql/bin/mysql_ssl_rsa_setup --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
update-rc.d mysqld defaults
service mysqld start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
mysql -uroot -p\'(+:rGtOj8><<\'
mysql> ALTER USER \'root\'@\'localhost\' IDENTIFIED BY \'1024\';
以上是关于Win10 子系统 WSL 编译安装MySQL5.7的主要内容,如果未能解决你的问题,请参考以下文章