mysql linux安装

rpm  版本 就是rpm -ivh 了
Mysql目录:/usr/bin 
启动mysql  /etc/init.d/mysql start
关闭mysql  mysqladmin -u root -p shutdown
或者用 service 命令
service mysql
Usage: /etc/init.d/mysql  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]

命令列表:

cd /home/tmp
rpm -ivh mysql-3.23.52-1.i386.rpm           //#安装mysql server
rpm -ivh mysql-client-3.23.52-1.i386.rpm   //#安装mysql client
/usr/mysql/safe_mysqld &                   //#启动mysql server
mysql       //#运行mysql 客户端,并开放root用户的远程访问权限,以便调试
use mysql
update user set host = '%' where user = 'root' and host <> 'localhost';
flush privileges;
quit              //至此mysql安装完成



一、编译mysql 5.0.40

#cd /usr/local/src

# tar zxvf mysql-5.0.40.tar.gz
# cd mysql-5.0.46

#./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-enterprise-gpl --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-ndb-debug --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock


配置成功会提示:

MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.

Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!


# make
编译的时间可能会比较长,毕竟优化的比较厉害。

# make install

编译安装完成后执行后续操作:
# useradd mysql //添加 mysql 用户
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root:mysql . //设置权限,注意后面有一个 "."
# chown -R mysql /var/lib/mysql //设置 mysql 目录权限
# chgrp -R mysql . //注意后面有一个 "."
# cp share/mysql/my-large.cnf /etc/my.cnf
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //开机自动启动 mysql。
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# /etc/init.d/mysqld start //启动 MySQL
#/usr/local/mysql/bin/mysqladmin -u root password "password_for_root"  // password_for_root为密码.本机是mysql

#/usr/local/mysql/bin/mysql –u root –p  //进入mysql客户端

(/usr/local/mysql/bin/mysql -u root -p  提示Enter password: 输入密码,回车进入)
# /etc/init.d/mysqld start  //关闭 MySQL

 

 

 

 

远程连接时如了出现:
INSERT INTO mysql.user (Host,User,Password) VALUES('%','plain',PASSWORD('123456'));

ERROR 1130: is not allowed to connect to this MySQL server

第一重要:查看Linux防火墙是否关掉;

再来看:

进入Linux

登录Mysql:

首先使用update把mysql.user中的root的host从localhost修改成%:
mysql> UPDATE mysql.user SET Host='%' WHERE Host='localhost' ;
mysql>GRANT ALL PRIVILEGES ON *.* TO ";
mysql> FLUSH PRIVILEGES ;
再次连接,显示成功。

posted on 2009-10-21 15:52  dhj  阅读(139)  评论(0编辑  收藏  举报

导航