PDA

View Full Version : cài mysql cho linux



tumickey
24-05-2005, 21:07
TMK sài bản:
mysql-standard-4.0.23-pc-linux-i686.tar.gz
Cài theo hướng dẫn
1. Setup
# tar -xzf mysql-standard-4.0.23-pc-linux-i686.tar.gz
# mv mysql-standard-4.0.23-pc-linux-i686 /usr/local/
# cd /usr/local
# ln -s mysql-standard-4.0.23-pc-linux-i686 mysql
# cd mysql
# groupadd mysql
# useradd -g mysql mysql
# cp support-files/my-medium.cnf /etc/my.cnf
# ./scripts/mysql_install_db --user=mysql
# chown -R root:mysql .
# chown -R mysql:mysql data
2. Startup
# ./bin/mysqld_safe --user=mysql --bind-address=127.0.0.1 &

(va em da thay 127.0.0.1 bang dia chi cua may em 192.168.0.5)

3. Cleanup
# ./bin/mysql_secure_installation
thi xuat hien nhung dong sau:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):

Sau khi em da nhap password cho root thi lai bao loi:

ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Hịc ai biết cài không chỉ tui coi

DoQuocDuy
24-05-2005, 21:36
TMK sài bản:
mysql-standard-4.0.23-pc-linux-i686.tar.gz
Cài theo hướng dẫn
1. Setup
# tar -xzf mysql-standard-4.0.23-pc-linux-i686.tar.gz
# mv mysql-standard-4.0.23-pc-linux-i686 /usr/local/
# cd /usr/local
# ln -s mysql-standard-4.0.23-pc-linux-i686 mysql
# cd mysql
# groupadd mysql
# useradd -g mysql mysql
# cp support-files/my-medium.cnf /etc/my.cnf
# ./scripts/mysql_install_db --user=mysql
# chown -R root:mysql .
# chown -R mysql:mysql data
2. Startup
# ./bin/mysqld_safe --user=mysql --bind-address=127.0.0.1 &

(va em da thay 127.0.0.1 bang dia chi cua may em 192.168.0.5)

3. Cleanup
# ./bin/mysql_secure_installation
thi xuat hien nhung dong sau:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):

Sau khi em da nhap password cho root thi lai bao loi:

ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Hịc ai biết cài không chỉ tui coi
cậu phải khởi động mysql server lên đã rồi mới change password cho root được.
khởi động:
su lên root:

[root@localhost ~]/etc/rc.d/init.d/mysql start
nếy có thông báo: MySQL start [OK] là success.
sau đó:

mysqladmin -uroot password new_password_here
password cho root lúc bấy giờ sẽ là:new_password_here
login vào mysql:


mysql -uroot -p
Enter password:gõ pass vào đây

tumickey
24-05-2005, 21:39
hihi thanks nhiều nha .wên phải vào quyền root