Problems encountered during development
Mysql Field Auto-Increment
In mysql, only one field can be set as an auto-increment field in each table. This field can be a primary key or a primary key. If it is not a primary key, it must be set as a key )",
Linux Command ps aux
In linux, You can query the processes using the ps and grep. For example, ps aux | grep httpd is used to query the account used by the httpd process.
Linux assigns folder permissions to a specified user
In linux, if you want to assign folder permissions to a user, you can use the chown command:
Chown-R apache. apache/data/www/project/can be used to change the owner group of all files and directories under/data/www/project/to an apache account.
MySQL encoding settings
I was killed by MySQL coding today. I wasted an afternoon working on Chinese Garbled text,
First, describe my problems:
Use the ssh client tool to insert data using SQL commands on windows,
The ssh tool uses SecureCRT 7.1, and the Session Options option is set to UTF8 encoding,
Then, when I use SQL commands to query the database, I can see normal Chinese data (this operation makes me mistakenly think that the data I inserted is UTF8 without garbled characters), and then when I query the database in PHP, the data displayed on the php page is garbled and it is preliminarily determined that there is a problem with the mysql encoding configuration,
According to the solution on the Internet:
Check the database encoding configuration first:
SHOW VARIABLES LIKE 'character_set_%';
After checking, we found that it was not utf8.
Then modify it:
Find the my. cnf file,
Find [mysqld] In the my. cnf file to add:
default-character-set=utf8init_connect='SET NAMES utf8'
Then restart the mysql service.
If default-character-set = utf8 causes mysql to fail to start, your mysql version can only support
character-set-server=utf8
At this time, I used the SQL command of the ssh client to query the data and found that the data I inserted was garbled.
There are other encoding settings:
Modify
default-character-set=utf8
In the configuration file "/var/lib/mysql/mydb/db. opt ",
default-character-set=utf8default-collation=utf8_general_ci