2010年10月14日 星期四

mysql 安裝與ajax with php測試

[root@localhost ajax-poll]# yum install mysql mysql-server -y

[root@localhost ajax-poll]# service mysqld start
[root@localhost ajax-poll]# chkconfig mysqld on
[root@localhost ajax-poll]# mysqladmin -u root password 'rootpass'
[root@localhost ajax-poll]# mysql -u root -p

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database syspage;
mysql> show databases;
+--------------------+
Database
+--------------------+
information_schema
mysql
syspage
test
+--------------------+
4 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON syspage.* to sean@local IDENTIFIED BY 'syspass';
mysql> GRANT ALL PRIVILEGES ON syspage.* to sean@localhost IDENTIFIED BY 'syspass';
mysql> GRANT ALL PRIVILEGES ON syspage.* to sean@172.16.43.98 IDENTIFIED BY 'syspass';
mysql> GRANT ALL PRIVILEGES ON syspage.* to sean@172.16.43.99 IDENTIFIED BY 'syspass';
mysql> GRANT ALL PRIVILEGES ON syspage.* to sean@172.16.43.144 IDENTIFIED BY 'syspass';
mysql> SHOW GRANTS FOR 'sean'@'localhost';
+------------------------------------------------------------------------------------+
Grants for sean@localhost
+------------------------------------------------------------------------------------+
GRANT USAGE ON *.* TO 'sean'@'localhost' IDENTIFIED BY PASSWORD '02be59854f8541f8'
GRANT ALL PRIVILEGES ON `syspage`.* TO 'sean'@'localhost'
+------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

[root@localhost ajax-poll]# cd ajax-poll
[root@localhost ajax-poll]# mysql -u root --password='rootpass' syspage < polls.sql
mysql> use syspage ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-------------------+
Tables_in_syspage
+-------------------+
options
questions
votes
+-------------------+
3 rows in set (0.00 sec)


[root@localhost ajax-poll]# yum install php php-devel php-mysql -y
[root@localhost html]# cp -r ~/Desktop/ajax-poll /var/www/html/.

[root@localhost ajax-poll]# cd /var/www/html/ajax-poll/

[root@localhost ajax-poll]# vi poll.php

$conn=mysql_connect('localhost', 'root', 'sikhadmin') or die("Can't connect to mysql host");
mysql_select_db('polls') or die("Can't connect to DB");


$conn=mysql_connect('localhost', 'root', 'rootpass') or die("Can't connect to mysql host");
mysql_select_db('syspage') or die("Can't connect to DB");





沒有留言:

張貼留言

文章分類