# rpm -qa | grep php
php-common-5.3.3-40.el6_6.i686
php-cli-5.3.3-40.el6_6.i686
php-5.3.3-40.el6_6.i686
# vi /etc/php.ini
.
register_globals = On
# service httpd restart
# vi /var/www/html/test.php
<?php
phpinfo();
php?>
+++++++++++++++++++++++++++++++++++++++++
# yum -y install mysql mysql-server
# rpm -qa | grep mysql
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.i686
mysql-server-5.1.73-3.el6_5.i686
# service mysqld start
# service mysqld status
# mysqladmin -u root password dd123 //設定root登入mysql密碼
# mysql -u root -p //帳號root登入mysql
Enter password:
mysql> show databases;
mysql> quit
# mysqladmin -u root -p password db123456 //變更root密碼
Enter password: //原密碼
~~~~~~~~~~~~變更MySQL預設編碼以免影響中文呈現
步驟1:
php程式中,資料開啟時加上
mysql_query("SET NAMES 'utf8'");
步驟2:似乎不需
# cp /etc/my.cnf /etc/my.cnf.bk
# cp /usr/share/doc/mysql-server-5.1.73/my-large.cnf /etc/my.cnf
# vi /etc/my.cnf
.
[client]
.
default-character-set=utf8
.
[mysqld]
.
default-character-set=utf8
init_connect='SET NAMES utf8'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+++++++++++++++++++++++++++++++++++++++++
# yum -y install php-mysql php-mbstring
# rpm -qa | grep php
php-common-5.3.3-40.el6_6.i686
php-mbstring-5.3.3-40.el6_6.i686
php-cli-5.3.3-40.el6_6.i686
php-mysql-5.3.3-40.el6_6.i686
php-5.3.3-40.el6_6.i686
php-pdo-5.3.3-40.el6_6.i686
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.10.8/phpMyAdmin-4.0.10.8-all-languages.tar.gz
# tar -zxvf phpMyAdmin-4.0.10.8-all-languages.tar.gz
# cp -r phpMyAdmin-4.0.10.8-all-languages /var/www/html/phpMyAdmin //-r複製目錄
# cd /var/www/html/phpMyAdmin/
# cp config.sample.inc.php config.inc.php
# vi config.inc.php
.
$cfg['Servers'][$i]['auth_type'] = 'http'; //原cookie改成http
# service mysqld restart
# service httpd restart
瀏覽器
http://192.168.2.105/phpMyAdmin
root
db123456
登入
++++++++++++++++++++++++++++++++++++++++++
phpMyAdmin
資料庫
建立資料庫:kkdb 編碼排序:utf8_unicode_ci -->建立
建立資料表:tblmen 欄數:4 -->執行
mid varchar 10 utf8_unicode_ci 索引:primary
na varchar 20 utf8_unicode_ci
accnt varchar 10 utf8_unicode_ci
pwd varchar 10 utf8_unicode_ci
編碼與排序: utf8_unicode_ci -->儲存
~~~~~~~~~~~~~由phpMyAdmin匯入文字資料
原始資料由EXCEL另存新檔-->存檔類型:文字檔(Tab字元分隔)-->按<是> -->再開啟所得文字檔,另存新檔-->存檔類型:UTF-8。
進入phpMyAdmin-->匯入-->選擇檔案-->首列跳過的列數:1(因EXCEL原始資料有標題列)-->格式:CSV-->格式選項:欄位分隔符號:\t (表示Tab字元分隔)-->執行。
# rpm -qa | grep mysql
mysql-libs-5.1.73-3.el6_5.i686
mysql-5.1.73-3.el6_5.i686
mysql-server-5.1.73-3.el6_5.i686
# service mysqld start
# service mysqld status
# mysqladmin -u root password dd123 //設定root登入mysql密碼
# mysql -u root -p //帳號root登入mysql
Enter password:
mysql> show databases;
mysql> quit
# mysqladmin -u root -p password db123456 //變更root密碼
Enter password: //原密碼
~~~~~~~~~~~~變更MySQL預設編碼以免影響中文呈現
步驟1:
php程式中,資料開啟時加上
mysql_query("SET NAMES 'utf8'");
步驟2:似乎不需
# cp /etc/my.cnf /etc/my.cnf.bk
# cp /usr/share/doc/mysql-server-5.1.73/my-large.cnf /etc/my.cnf
# vi /etc/my.cnf
.
[client]
.
default-character-set=utf8
.
[mysqld]
.
default-character-set=utf8
init_connect='SET NAMES utf8'
.
# service mysqld restart
# mysql -u root -p
Enter password:
mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+++++++++++++++++++++++++++++++++++++++++
# yum -y install php-mysql php-mbstring
# rpm -qa | grep php
php-common-5.3.3-40.el6_6.i686
php-mbstring-5.3.3-40.el6_6.i686
php-cli-5.3.3-40.el6_6.i686
php-mysql-5.3.3-40.el6_6.i686
php-5.3.3-40.el6_6.i686
php-pdo-5.3.3-40.el6_6.i686
# tar -zxvf phpMyAdmin-4.0.10.8-all-languages.tar.gz
# cp -r phpMyAdmin-4.0.10.8-all-languages /var/www/html/phpMyAdmin //-r複製目錄
# cd /var/www/html/phpMyAdmin/
# cp config.sample.inc.php config.inc.php
# vi config.inc.php
.
$cfg['Servers'][$i]['auth_type'] = 'http'; //原cookie改成http
# service mysqld restart
# service httpd restart
瀏覽器
http://192.168.2.105/phpMyAdmin
root
db123456
登入
++++++++++++++++++++++++++++++++++++++++++
phpMyAdmin
資料庫
建立資料庫:kkdb 編碼排序:utf8_unicode_ci -->建立
建立資料表:tblmen 欄數:4 -->執行
mid varchar 10 utf8_unicode_ci 索引:primary
na varchar 20 utf8_unicode_ci
accnt varchar 10 utf8_unicode_ci
pwd varchar 10 utf8_unicode_ci
編碼與排序: utf8_unicode_ci -->儲存
~~~~~~~~~~~~~由phpMyAdmin匯入文字資料
原始資料由EXCEL另存新檔-->存檔類型:文字檔(Tab字元分隔)-->按<是> -->再開啟所得文字檔,另存新檔-->存檔類型:UTF-8。
進入phpMyAdmin-->匯入-->選擇檔案-->首列跳過的列數:1(因EXCEL原始資料有標題列)-->格式:CSV-->格式選項:欄位分隔符號:\t (表示Tab字元分隔)-->執行。
沒有留言:
張貼留言