Slackware 14上配置MySQL与PHP笔记

{
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

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值