openwrt에서 mysql설치해보자
참고문서 : http://wiki.openwrt.org/doc/howto/lamp
root@OpenWrt:/mnt/usb1# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 30.4M 8.7M 21.7M 28% /
tmpfs 30.2M 76.0K 30.2M 0% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
root@OpenWrt:/mnt/usb1#
root@OpenWrt:/mnt/usb1# opkg update
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
root@OpenWrt:/mnt/usb1#
root@OpenWrt:/mnt/usb1# opkg install libpthread libncurses libreadline mysql-server
Package libpthread (0.9.30.1-43.32) installed in root is up to date.
Installing libncurses (5.7-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libncurses_5.7-2_ar71xx.ipk.
Installing libreadline (5.2-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libreadline_5.2-2_ar71xx.ipk.
Installing mysql-server (5.1.53-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/mysql-server_5.1.53-2_ar71xx.ipk.
Installing libmysqlclient (5.1.53-2) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libmysqlclient_5.1.53-2_ar71xx.ipk.
Installing uclibcxx (0.2.2-3) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/uclibcxx_0.2.2-3_ar71xx.ipk.
Configuring libmysqlclient.
Configuring uclibcxx.
Configuring mysql-server.
Configuring libreadline.
Configuring libncurses.
root@OpenWrt:/mnt/usb1# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 30.4M 12.1M 18.3M 40% /
tmpfs 30.2M 1.5M 28.7M 5% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
root@OpenWrt:/mnt/usb1#
root@OpenWrt:~# sed -i 's,^datadir.*,datadir = "/srv/mysql",g' /etc/my.cnf
root@OpenWrt:~#
root@OpenWrt:~# sed -i 's,^tmpdir.*,tmpdir = "/tmp",g' /etc/my.cnf
root@OpenWrt:~# mkdir -p /srv/mysql
root@OpenWrt:~# mysql_install_db --force
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h OpenWrt password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/scripts/mysqlbug script!
root@OpenWrt:~#
root@OpenWrt:~# /etc/init.d/mysqld start
Starting MySQL daemon... done
root@OpenWrt:~# /etc/init.d/mysqld enable
mysqladmin -u root password 'new-password'
root@OpenWrt:~# opkg update
opkg install php5-mod-mysqlDownloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
root@OpenWrt:~# opkg install php5-mod-mysql
Installing php5-mod-mysql (5.3.6-3.3) to root...
Downloading http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/php5-mod-mysql_5.3.6-3.3_ar71xx.ipk.
Configuring php5-mod-mysql.
root@OpenWrt:~#
root@OpenWrt:~# sed -i 's,;extension=mysql.so,extension=mysql.so,g' /etc/php.ini
root@OpenWrt:~#
root@OpenWrt:~# netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2331/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1525/uhttpd
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1555/vsftpd
tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 1550/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1512/dropbear
tcp 0 48 192.168.1.1:22 210.115.223.46:58963 ESTABLISHED 2283/dropbear
netstat: /proc/net/tcp6: No such file or directory
udp 0 0 0.0.0.0:53 0.0.0.0:* 1550/dnsmasq
udp 0 0 0.0.0.0:67 0.0.0.0:* 1550/dnsmasq
netstat: /proc/net/udp6: No such file or directory
netstat: /proc/net/raw6: No such file or directory
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 6 [ ] DGRAM 260 303/syslogd /dev/log
unix 2 [ ACC ] STREAM LISTENING 3849 2331/mysqld /var/run/mysqld.sock
unix 2 [ ] DGRAM 1054 835/hostapd /var/run/hostapd-phy0/wlan0
unix 2 [ ACC ] STREAM LISTENING 3695 2283/dropbear /tmp/dropbear-ad87d49d/auth-59b4374a-7
unix 2 [ ] DGRAM 1878 835/hostapd
unix 2 [ ] DGRAM 1670 1550/dnsmasq
unix 2 [ ] DGRAM 1629 1512/dropbear
unix 2 [ ] DGRAM 265 305/klogd
root@OpenWrt:~#
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 30.4M 12.5M 17.9M 41% /
tmpfs 30.2M 1.5M 28.7M 5% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
root@OpenWrt:~#
mysql –uroot –p패스워드 하면 잘된다.
'IT 개발 > OS-LINUX' 카테고리의 다른 글
crontab 옵션 (0) | 2012.08.29 |
---|---|
tar 옵션 (파일내용보기, 특정파일만 풀기) (0) | 2012.08.10 |
OpenWRT설정 (현재 내가 쓰고 있는 설정) (0) | 2012.05.18 |
페도라코어8이상에서 ssh포트문제 (0) | 2011.08.23 |
리눅스 SSH 활용 (0) | 2011.08.23 |