Slackware 14上配置MySQL与PHP笔记
2014-02-09 19:40
465 查看
{
MySQL on Slackware 14.0.
2014-02-09
Run:
mysql --version
The version of mysql included in Slackware 14 is 5.5.27.
http://dev.mysql.com/doc/refman/5.0/en/postinstallation.html
mysql_install_db will install a system database.
Then, invoke:
mysqld_safe
However, it quits immediately. Checking the log file it mentions: /var/lib/mysql/darkstar.err, it mentions that host.frm cannot be created.
strace shows that it tries to access below directories:
/var/lib/mysql
/var/run/mysql
/usr/data/mysql
/usr/var/mysql
(strace command line:
strace mysqld_safe 2>&1 | vim - -n
)
http://bugs.mysql.com/bug.php?id=1279 -- According to this web page, it is a permission issue. Run the commands below to fix:
chown -R mysql /var/lib/mysql
chgrp -R mysql /var/lib/mysql
chown -R mysql /var/run/mysql
chgrp -R mysql /var/run/mysql
}
{
Second step after running mysql_install_db is to run:
mysqladmin -u root password 'pwd...'
Now I can access mysql using the "mysql" command (alternatively, connection can be tested via "telnet localhost 3306" if mysqld_safe is used; Slackware start script doesn't allow 3306 access):
mysql --user=root --password='pwd...'
But slackware still doesn't automatically start the server.
http://www.linuxquestions.org/questions/slackware-14/how-to-auto-start-my-sql-server-upon-reboot-404452/ -- according to
this post, I ran the following command and it works:
chmod ugo+x /etc/rc.d/rc.mysqld
}
{
PHP version 5.4.7
First we need to know where the root directory for PHP resides. For this, we check the php initialization file:
vim -R /etc/httpd/php.ini
http://php.net/manual/en/security.cgi-bin.doc-root.php -- by default, doc_root equals the Apache document root, which can be found in httpd.conf, which is /srv/httpd/htdocs.
Also, uncomment the "Include /etc/httpd/mod_php.conf" line to enable PHP. A restart is required.
I didn't modify doc_root. I just put phpMyAdmin files at /srv/httpd/htdocs/phpmyadmin. Then, I found that, when I access
http://localhost/phpmyadmin, it shows the directory listing instead invoking index.php. I checked httpd.conf and found the DirectoryIndex configuration in mod_dir. Configure it to support index.php:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
PHP can also be used from the command line. To run it, just use the "php" command (where "^D" means pressing Ctrl-D):
php
<?php echo 'Robbie is a hacker.'; ?>
^D
}
MySQL on Slackware 14.0.
2014-02-09
Run:
mysql --version
The version of mysql included in Slackware 14 is 5.5.27.
http://dev.mysql.com/doc/refman/5.0/en/postinstallation.html
mysql_install_db will install a system database.
Then, invoke:
mysqld_safe
However, it quits immediately. Checking the log file it mentions: /var/lib/mysql/darkstar.err, it mentions that host.frm cannot be created.
strace shows that it tries to access below directories:
/var/lib/mysql
/var/run/mysql
/usr/data/mysql
/usr/var/mysql
(strace command line:
strace mysqld_safe 2>&1 | vim - -n
)
http://bugs.mysql.com/bug.php?id=1279 -- According to this web page, it is a permission issue. Run the commands below to fix:
chown -R mysql /var/lib/mysql
chgrp -R mysql /var/lib/mysql
chown -R mysql /var/run/mysql
chgrp -R mysql /var/run/mysql
}
{
Second step after running mysql_install_db is to run:
mysqladmin -u root password 'pwd...'
Now I can access mysql using the "mysql" command (alternatively, connection can be tested via "telnet localhost 3306" if mysqld_safe is used; Slackware start script doesn't allow 3306 access):
mysql --user=root --password='pwd...'
But slackware still doesn't automatically start the server.
http://www.linuxquestions.org/questions/slackware-14/how-to-auto-start-my-sql-server-upon-reboot-404452/ -- according to
this post, I ran the following command and it works:
chmod ugo+x /etc/rc.d/rc.mysqld
}
{
PHP version 5.4.7
First we need to know where the root directory for PHP resides. For this, we check the php initialization file:
vim -R /etc/httpd/php.ini
http://php.net/manual/en/security.cgi-bin.doc-root.php -- by default, doc_root equals the Apache document root, which can be found in httpd.conf, which is /srv/httpd/htdocs.
Also, uncomment the "Include /etc/httpd/mod_php.conf" line to enable PHP. A restart is required.
I didn't modify doc_root. I just put phpMyAdmin files at /srv/httpd/htdocs/phpmyadmin. Then, I found that, when I access
http://localhost/phpmyadmin, it shows the directory listing instead invoking index.php. I checked httpd.conf and found the DirectoryIndex configuration in mod_dir. Configure it to support index.php:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
PHP can also be used from the command line. To run it, just use the "php" command (where "^D" means pressing Ctrl-D):
php
<?php echo 'Robbie is a hacker.'; ?>
^D
}
相关文章推荐
- #实践笔记#Ubuntu配置Apache+PHP+MySQL
- php mysql apache 配置笔记
- 在OpenSUSE上配置Apache+MySQL+PHP(写给自己看的笔记)
- Linux+Nginx+Apache+PHP+Mysql安装配置笔记
- mac上配置nginx+PHP+MySQL的笔记
- LNAMP(Debian + Nginx + Apache + Mysql + PHP)配置笔记
- LNMP(linux+nginx+mysql+php)源码安装及协调配置测试笔记
- 运维笔记43 使用saltstack配置完整线上服务(haproxy+keepalived,nginx+php+memcache,mysql主从)
- linux下apache、mysql、php安装配置详细笔记
- (转载)Linux下安装配置MySQL+Apache+PHP+WordPress的详细笔记
- Windows下Apache + MySQL配置PHP环境笔记
- 【配置服务器环境学习笔记】linux服务器配置php+mysql+Apache
- 开发服务器配置笔记 (Apache PHP MySQL SVN Trac)
- ubuntu 12.04 server《一》 apache+php+mysql 菜鸟配置笔记(合成,整理,实操版)
- Windows下Apache + MySQL配置PHP环境笔记
- #实践笔记#Ubuntu配置Apache+PHP+MySQL
- PHP随堂笔记mysql的模块配置
- 实践笔记#Ubuntu配置Apache+PHP+MySQL
- php WNMP(Windows+Nginx+Mysql+php)配置笔记
- PHP学习笔记1 - MySQL免安装版配置