grant select on 数据库.* to 用户名@登录主机 identified by "密码"
grant select,insert,update,delete on *.* to user_1@'%' Identified by '123';
grant all on *.* to user_1@'localhost' Identified by '123';
远程访问
其一:
GRANT ALL PRIVILEGES ON *.* TO xoops_root@'%' IDENTIFIED BY '654321';
允许xoops_root用户可以从任意机器上登入MySQL。
其二:
编辑 /etc/mysql/my.cnf
>skip-networking => # skip-networking
这样就可以允许其他机器访问MySQL了。 grant all on *.* to 'root'@'ip' identified by 'password';
备份与恢复
备份
进入到库目录,cd /val/lib/mysql
mysqldump -u root -p --opt aaa > back_aaa
恢复
mysql -u root -p ccc < back_aaa /***********************************************************************************/
2.安装apache
这部分转自:http://www.iyunv.com/huzhiwei/archive/2012/07/19/2599854.html
/***********************************************************************************/
不知道为什么在安装apache2.2.22版本的时候没有任何问题,直接使用命令
./configure --prefix=/usr/local/apache2 –-sysconfdir=/etc/httpd --enable-proxy --enable-so --enable-mods-shared=most --with-mpm=worker --enable-shared=max --enable-module=rewrite --enable-module=so
没有任何问题,不过在安装新版本2.4.2的时候就会报错。
解决方案如下:
#./configure --prefix……检查编辑环境时出现:
checking for APR... no
configure: error: APR not found . Please read the documentation.
可以用./configure –help | grep apr 查看帮助。
--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to apr-config
--with-apr-util=PATH prefix for installed APU or the full path to
安装APR(Apache Portable Runtime )
[iyunv@localhost ~]# cd /tmp/52lamp/ //源码存放位置
[iyunv@localhost 52lamp]# tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip
[iyunv@localhost 52lamp]# cd apr-1.4.2
[iyunv@localhost apr-1.4.2]# ./configure
[iyunv@localhost apr-1.4.2]# make
[iyunv@localhost apr-1.4.2]# make install
再次检查编译环境出现
checking for APR-util... no
configure: error: APR-util not found . Please read the documentation.
[iyunv@localhost httpd-2.2.16]# ./configure –help | grep apr-util
--with-apr-util=PATH prefix for installed APU or the full path to
[iyunv@localhost 52lamp]# tar -zxvf apr-util-1.3.9.tar.gz
[iyunv@localhost 52lamp]# cd apr-util-1.3.9
[iyunv@localhost apr-util-1.3.9]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[iyunv@localhost apr-util-1.3.9]# make
[iyunv@localhost apr-util-1.3.9]# make install
./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[iyunv@localhost httpd-2.2.16]# ./configure –help | grep pcre
--with-pcre=PATH Use external PCRE library
[iyunv@localhost 52lamp]# unzip -o pcre-8.10.zip
[iyunv@localhost 52lamp]# cd pcre-8.10
[iyunv@localhost cd pcre-8.10]# ./configure --prefix=/usr/local/pcre
[iyunv@localhost cd pcre-8.10]# make
[iyunv@localhost cd pcre-8.10]# make install
继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了。
/***********************************************************************************/
测试一下Apache配置文件的语法
/usr/local/apache2/bin/apachectl –t
启动Apache
/usr/local/apache2/bin/apachectl -k start&
我在安装的时候就有明明安好,但是无法启动apache的现象,百思不得其解。后来换了个低版本的安装,就发现能够正常启动了。好像是apache对apr和apr-util的版本是有要求的。
将Apache添加到自动启动中
echo '/usr/local/apache2/bin/apachectl -k start&'>>/etc/rc.d/rc.local
检查Apache的端口是否跑起来了
netstat -an |grep 80
将Apache添加到系统服务中去
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc4.d/S61httpd
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3./configure --prefix=/usr/local/zlib
make && sudo make install
##### FreeType #####
tar -jxvf freetype-2.3.5.tar.bz2
cd freetype-2.3.5./configure --prefix=/usr/local/freetype
make && sudo make install
##### LibPNG #####
tar -zxvf libpng-1.2.20.tar.gz
cd libpng-1.2.20
cp scripts/makefile.linux makefile
./configure --prefix=/usr/local/libpng
make && make install
##### Jpeg (让GD支持JPEG)#####
tar -zxvf jpegsrc.v6b.tar.gz
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make && make install
##### GD Library #####
tar -zxvf gd-2.0.35.tar.gz
cd gd-2.0.35./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png --with-zlib=/usr/local/zlib
make && make install