owned this note
owned this note
Published
Linked with GitHub
MySQL
===
# MYSQL SETTING
```
[root@localhost conf.d]# sudo service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@localhost conf.d]# sudo grep 'temporary password' /var/log/mysqld.log
2017-05-03T05:55:14.109793Z 1 [Note] A temporary password is generated for root@localhost: TaiOnb;3!B3k
[root@localhost conf.d]#
```
```
[root@localhost conf.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.7.18
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu168';
```
```
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu168';
Query OK, 0 rows affected (0.01 sec)
mysql> SHOW databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.05 sec)
mysql>
```
If something goes wrong during installation, you might find debug information in the error log file /var/log/mysqld.log.
```
mysql> CREATE DATABASE msgbaord;
Query OK, 1 row affected (0.00 sec)
mysql> USE msgboard
ERROR 1049 (42000): Unknown database 'msgboard'
mysql> DROP DATABASE msgbaord;
Query OK, 0 rows affected (0.06 sec)
mysql> CREATE DATABASE msgboard;
Query OK, 1 row affected (0.01 sec)
mysql> USE msgboard;
Database changed
```
---
```
mysql> CREATE TABLE msglist ( user VARCHAR(25) NOT NULL , text VARCHAR(128) NOT NULL ) ENGINE = InnoDB;
Query OK, 0 rows affected (0.08 sec)
```
```
2017/05/04 04:01:55 [error] 58831#0:
*56 FastCGI sent in stderr:
"PHP message: PHP Warning:
mysql_connect():
Headers and client library minor version mismatch.
Headers:
50550
Library:
50631 in /usr/share/nginx/html/msg_board/dbconfig.php on line 6" while reading response header from upstream,
client: 192.168.171.1,
server: test123,
request: "POST /msg_board/add_data.php HTTP/1.1",
upstream: "fastcgi://127.0.0.1:9000", host: "test123",
referrer: "http://test123/msg_board/add_data.php"
```
版本不符合
http://stackoverflow.com/questions/10759334/headers-and-client-library-minor-version-mismatch
先將PHP的資訊列出來
```bash=
php -i > log.txt
vim log.txt
```
/API
可以發現
```
Client API library version => 5.6.31
Client API header version => 5.5.50-MariaDB
```
```
[root@localhost nginx]# mysql -V
mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper
[root@localhost nginx]# php -v
PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)
```
---
```bash=
yum list|grep -i mysql
php-mysqlnd.x86_64 5.4.16-42.el7 base
```
更新PHP 5.4 到 5.6 後各種設定跑掉
確定一下php-fpm 各種設定
nginx 應該不用動 不過要重啟
權限要設定好
更改 conf.d/default 中的 user 從apache 到 nginx
```
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
```
# https://kknews.cc/other/qye96lb.html 詳細
# How to Fix PHP Error: Call to undefined function posix_getpwuid()
```bash=
yum install php-posix
```
解決無法用ssh連入的問題
```
Connecting to 172.17.11.147:22...
Could not connect to '172.17.11.147' (port 22): Connection failed.
Type `help' to learn how to use Xshell prompt.
Xshell:\>
```
先關掉防火牆重啟看看
```
出现这种情况的原因:
1.服务器端防火墙关闭了22端口,没有开启ssh服务;
2.没有安装ssh;
解决原因1:使用netstat,查看是否启动shh服务;
开启ssh服务:service sshd start
关闭ssh服务:service sshd stop
重启ssh服务:servcie sshd restart
SSH服务开机自动启动:chkconfig sshd on
取消开机自启动:chkconfig sshd off
开启服务后,检查服务状态:service sshd status
解决原因2:安装ssh:
yum install openssh-server
```
沒用
service ssh status
```
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: activating (auto-restart) (Result: exit-code) since Thu 2016-05-05 03:30:48 UTC; 2s ago
Process: 10938 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
Process: 10944 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=255)
Main PID: 10944 (code=exited, status=255)
May 05 03:30:48 ixnetwork-uk1 systemd[1]: sshd.service: main process exited, code=exited, status=255/n/a
May 05 03:30:48 ixnetwork-uk1 systemd[1]: Unit sshd.service entered failed state.
```
# SELinux
https://blog.ixnet.work/2016/05/05/change-centos-ssh-port/
https://serverfault.com/questions/538037/sshd-service-fails-to-start
http://asherwang.blog.51cto.com/11255017/1894122
yum provides /usr/sbin/semanage
yum -y install policycoreutils-python
semanage port -l | grep ssh
只允許port 22
http://sharadchhetri.com/2014/10/15/centos-7-rhel-7-change-openssh-port-number-selinux-enabled/
去修改ssd_config port 然後新增規則
# 永久性的關掉 selinux
$ sudo vi /etc/sysconfig/selinux
找到
SELINUX=enforcing
然後修改為
SELINUX=disabled
要重新開機 reboot / restart 後才會套用
http://blog.xuite.net/tolarku/blog/195633562-CentOS+%E9%97%9C%E9%96%89+selinux
終於成功了QQ
解決403問題
從 nginx log 發現可能是 php-fpm 的問題
再看到 php-fpm log
```
[22-May-2017 08:43:38] WARNING: [pool www] child 2037 said into stderr: "ERROR: Unable to set php_value 'soap.wsdl_cache_dir'"~
```
找到 php-fpm.d/www.conf
```
; Set session path to a directory owned by process user~
224 php_value[session.save_handler] = files~
225 php_value[session.save_path] = /var/lib/php/session~
226 php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache~
```
```bash=
yum install php56w-soap
```
# Primary script unknown because nginx doesn't have the right to access dir
http://stackoverflow.com/questions/24208139/nginx-php-fpm-file-not-found
---
6
down vote
If you checked every thing and it's correct configured, then there is last point i got:
check that correct username if mentioned in file /etc/php-fpm.d/www.conf
shareimprove this answer
answered Feb 24 '15 at 13:11
Nazir
1,4451419
2
Exactly this problem on OS X Yosemite with PHP 5.6 installed via Homebrew. It's quite tricky to debug because neither the Nginx error log or the php-fpm error log, even in "Debug" mode, apparently won't give you any further details than "Primary Script Unknown". The default user/group is _www:_www, which may well be not what you want (I use [myname]:staff). To restart use sudo /usr/local/opt/php56/sbin/php56-fpm restart. – William Turrell Aug 2 '15 at 15:13
This helped me after wasting an hour trying to find a solution. Thanx – Sahil May 1 '16 at 22:48
---