8/1/12

CHƯƠNG 06: QUẢN LÝ CƠ SỞ DỮ LIỆU TRÊN LINUX


1.      CHƯƠNG 06: QUẢN LÝ CƠ SỞ DỮ LIỆU TRÊN LINUX

1.1.         CƠ SỞ DỮ LIỆU MYSQL

1.1.1.     CÀI ĐẶT MYSQL

[root@linux ~]#yum -y install mysql-server

[root@linux ~]#/etc/rc.d/init.d/mysqld start
Initializing MySQL database:  Installing MySQL system tables...OK
Filling help tables...  OK
……………………………………………………………………
Please report any problems with the /usr/bin/mysqlbug script!
Starting mysqld:              [  OK  ]

[root@linux ~]#chkconfig mysqld on

[root@linux ~]#mysql -u root
# connect to MySQL
mysql>select user,host,password from mysql.user;
# set root password
mysql>set password for root@localhost=password('password');
Query OK, 0 rows affected (0.00 sec)
# set root password
mysql>set password for root@'127.0.0.1'=password('password');
Query OK, 0 rows affected (0.00 sec)
# set root password
mysql>set password for root@'www.serverlinux'=password('password');
Query OK, 0 rows affected (0.00 sec)
# delete anonymous user
mysql>delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)
mysql>select user,host,password from mysql.user;
mysql>exit # quit
Bye

[root@linux ~]#mysql -u root -p # connect with root
Enter password:   # MySQL root password
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>exit
Bye

1.1.2.     CÀI ĐẶT VÀ CẤU HÌNH PHPMYADMIN


[root@linux ~]#yum --enablerepo=epel -y install phpMyAdmin php-mysql php-mcrypt
# install from EPEL

[root@linux ~]#vi /etc/httpd/conf.d/phpMyAdmin.conf
# line 14: add IP address you permit
Allow from 127.0.0.1
10.0.0.0/24

[root@linux ~]#/etc/rc.d/init.d/httpd reload
Reloading httpd:        [ OK ]
Truy cập 'http://(hostname hoặc IP address)/ trong trình duyệt để truy cập vào cơ sở dữ liệu với user của MySQL.

Bài đăng phổ biến