一、LAMP 安装
groupadd mysql
useradd mysql -g mysql -M -s /bin/false
cd /home/admin
tar zxvf mysql-5.0.20a.tar.gz
cd mysql-5.0.20a
./configure --prefix=/usr/local/mysql --without-debug --with-extra-charsets=utf8
make
make install
sleep 3
/bin/rm /etc/my.cnf
scripts/mysql_install_db
cp support-files/my-medium.cnf /etc/my.cnf
chmod -R 750 /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysqld_safe &
sleep 3
/usr/local/mysql/bin/mysqladmin -uroot password 123456
cd /home/admin
tar zxvf httpd-2.2.3.tar.gz
cd httpd-2.2.3
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-module=so
make
make install
sleep 3
cd /home/admin
rpm -ivh xpm-3.4k-2.i386.rpm
sleep 3
tar zxvf libxml2-2.6.20.tar.gz
cd libxml2-2.6.20
./configure
make
make install
sleep 3
cd /home/admin
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
make install
sleep 3
cd /home/admin
tar zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
make
make install
sleep 3
cd /home/admin
tar zxvf libpng-1.2.14.tar.gz
cd libpng-1.2.14
cp scripts/makefile.std makefile
make
make test
make install
sleep 3
cd /home/admin
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/usr/local/jpeg6
make
make install-lib
make install
sleep 3
cd /usr/local
tar zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local --with-zlib=/usr/local --with-freetype=/usr/local
make
make install
sleep 10
#cd /home/admin
#tar zxvf php-5.1.6.tar.tar
#cd cd php-5.1.6
#./configure --prefix=/usr/local/php --with-gd=/usr/local/gd/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib=/usr/local/ --with-png=/usr/local/ --with-freetype-dir=/usr/local/ --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars
#make
#make install
#cp php.ini-dist /usr/local/app/php/lib/php.ini
二、解决Mysql 数据库导入数据中文是乱码的问题。
1、
文件/etc/my.cnf加入default-character-set=utf8:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
default-character-set=utf8
2、
安装mysql客户端mysql-5.0.22-win32.zip
为了让其在任何路径下都能执行mysql的命令,设置环境变量方法 我的电脑属性---高级---环境变量---系统变量---选择Path---点击编辑---将mysql的安装路径(bin)加入
导入数据操作步骤
C:\Documents and Settings\Administrator>mysql -h 192.168.1.238 -uuser -ppass --default-character-set=utf8 databasesname < F:\news\student.sql
以上导入个人的中文乱码问题解决,不知在其他的情况下能否解决。
三、有关Mysql 基本设置
1、更改密码
将密码设置为空
root:/usr/local/mysql/bin>./mysqladmin -uroot -p123456 password ''
root:/usr/local/mysql/bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 106 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
给Mysql用户添加密码
root:/usr/local/mysql/bin>./mysqladmin -uroot -p password 123456
Enter password:
root:/usr/local/mysql/bin>mysql
ERROR 1045 (00000): Access denied for user: 'root@localhost' (Using password: NO)
root:/usr/local/mysql/bin>mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 111 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
mysql>update user set password=password('new_password') where user='user';
mysql>flush privileges;
2、数据库导入导出
创建数据库
mysqladmin create 数据库名
C:\Documents and Settings\Administrator>mysqladmin -h 192.168.1.238 -ubo -pbo create mytest
导出数据库
mysqldump 数据库名 > 文件名
C:\Documents and Settings\Administrator>mysqldump -h 192.168.1.238 -ubo -pbo cacti > D:\cacti.sql
导入数据库
mysql 数据库名 < 文件名
C:\Documents and Settings\Administrator>mysql -h 192.168.1.238 -ubo -pbo mytest < D:\cacti.sql
导出数据库结构
C:\Documents and Settings\Administrator>mysqldump -d -h 192.168.1.238 -ubo -pbo cacti > D:\cactijg.sql
常见问题:
1、
mysql 导库出现的错误
[root@test-linux downloads]# /usr/local/mysql/bin/mysql -uroot -p123456 bbs < dbbbs1216
ERROR 1115 (42000) at line 23: Unknown character set: 'gbk'
[root@test-linux downloads]#
将备份文件中的gbk 更改为utf8 从新执行命令可以了。