-
-
Save Jamp/7b6aa391f4dcdc738b89391de2a8aa6f to your computer and use it in GitHub Desktop.
Build and install MySQL 5.1 from source on Ubuntu 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run as root | |
set -e | |
apt-get update | |
apt-get install -y build-essential | |
apt-get install -y libncurses5-dev | |
useradd mysql | |
cd | |
wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.73.tar.gz | |
tar xzvf mysql-5.1.73.tar.gz | |
cd mysql-5.1.73 | |
./configure \ | |
'--prefix=/usr' \ | |
'--exec-prefix=/usr' \ | |
'--libexecdir=/usr/sbin' \ | |
'--datadir=/usr/share' \ | |
'--localstatedir=/var/lib/mysql' \ | |
'--includedir=/usr/include' \ | |
'--infodir=/usr/share/info' \ | |
'--mandir=/usr/share/man' \ | |
'--with-system-type=debian-linux-gnu' \ | |
'--enable-shared' \ | |
'--enable-static' \ | |
'--enable-thread-safe-client' \ | |
'--enable-assembler' \ | |
'--enable-local-infile' \ | |
'--with-fast-mutexes' \ | |
'--with-big-tables' \ | |
'--with-unix-socket-path=/var/run/mysqld/mysqld.sock' \ | |
'--with-mysqld-user=mysql' \ | |
'--with-libwrap' \ | |
'--with-readline' \ | |
'--with-ssl' \ | |
'--without-docs' \ | |
'--with-extra-charsets=all' \ | |
'--with-plugins=max' \ | |
'--with-embedded-server' \ | |
'--with-embedded-privilege-control' | |
make | |
make install | |
mkdir -p /etc/mysql | |
mkdir -p /var/lib/mysql | |
mkdir -p /etc/mysql/conf.d | |
echo -e '[mysqld_safe]\nsyslog' > /etc/mysql/conf.d/mysqld_safe_syslog.cnf | |
cp /usr/share/mysql/my-medium.cnf /etc/mysql/my.cnf | |
sed -i 's#.*datadir.*#datadir = /var/lib/mysql#g' /etc/mysql/my.cnf | |
chown mysql:mysql -R /var/lib/mysql | |
mysql_install_db --user=mysql | |
mysqld_safe -user=mysql & | |
/usr/bin/mysql_secure_installation | |
cp /usr/share/mysql/mysql.server /etc/init.d/mysql | |
chmod +x /etc/init.d/mysql | |
update-rc.d mysql defaults |
@RayNawara it doesn't particularly matter, because on line 11, it executes cd
with no arguments, which will change to the home directory of whatever user you're logged in as (likely /root
if you're running as root per the usage instructions on line 2) and it will do the remaining tasks from there.
@predators46 I think your problem is related to openwrt and gcc, not only mysql. I see you already tried asking on the openwrt forum and received no answers.
It looks like solution above ("patch mysql.cc") allowed you to get past the "narrowing conversion" error, but now you have a different problem. I don't know the answer, but try searching the web for "undefined reference to __sync_fetch_and_add_8". You are on a special journey, good luck.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably a stupid question but what directory should I be in to start this script? Anywhere special? Any one place better than another?
Thanks!