首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 冲浪宝典 > 网络资源 > MySQL4.1.20编译安装
【标  题】:MySQL4.1.20编译安装
【关键字】:MySQL4.1.20
【来  源】:http://www.cublog.cn/u/23566/showart.php?id=165960

MySQL4.1.20编译安装

通过源代码安装

下载软件并解压缩文件

(RH7.x下编译安装前需要库ncursesncurses-develtermcapg++,并在编译时export CXX="gcc")

OSMandrake Linux 1064-bit

shell> cd mysql-VERSION

shell>./configure --prefix=/usr/local/mysql --enable-assembler

--localstatedir=/usr/local/mysql/data --with-mysql-ldflags=-all-static --with-unix-socket-

path=/usr/local/mysql/tmp/mysql.sock --with-charset=gb2312

 

选项--with-extra-charsets可以设置多个语言支持,参数可以是”complex””all”或者字符集组合(用空格分开)。

选项--with-mit-threads,在INSTALL-SOURCE文件中有相关描述,一般不用加入。

编译成功后,会生成一个Makefile文件。若执行make时提示“No target...”,可能是configure没有成功。

 

shell> make

shell> make install

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> cd /usr/local/mysql

shell> bin/mysql_install_db --user=mysql            必须在启动服务之前安装数据库

shell> chown –R mysql:mysql /usr/local/mysql

shell> bin/mysqld_safe --user=mysql &              mysql用户登陆后启动服务,这样的操作才可以自建一些相关目录(如tmp),若以root用户启动服务,则需要在/root下有对tmp操作的权限

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root -h ybserv64bit password 'new-password'

See the manual for more instructions.

 

You can start the MySQL daemon with:

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

 

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:

cd sql-bench ; perl run-all-tests

 

启动文件supports/mysql.server

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based

# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.

# When this is done the mysql server will be started when the machine is

# started and shut down when the systems goes down.

 

 

无法连接数据库问题ERROR 2002

如果提示“/var/lib/mysql/mysql.sock”这个文件相关内容,为 mysql.sock 加个连接,比如说实际的mysql.sock /tmp/ 下,则
#ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

 

做好连接,若还不能连接数据库,查看相关文件夹和文件的访问权限,确保其它人也可以访问到文件mysql.sock

 

登录MySQL

使用mysql提供的客户端工具登录
#PATH_TO_MYSQL/bin/mysql -uuser -ppassword dateabase

 

修改数据库访问密码

可以用

mysqladmin -u用户名 -p旧密码 password 新密码

来修改密码。

 

忘记数据库root密码

如果 MySQL 正在运行,首先杀之: killall -TERM mysqld
启动 MySQL PATH_TO_MYSQL/bin/mysqld --skip-grant-tables &
就可以不需要密码就进入 MySQL 了。

然后就是
mysql>use mysql
mysql>update user set password=password("new_pass") where user="root";
mysql>flush privileges;
重新杀 MySQL ,用正常方法启动 MySQL
一定注意:很多新手没有用password=password("..."),而是直接password="..."所以改掉密码不好使。

 

不能远程连接的问题ERROR 1130

解决方法:
1
改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

mysql -u root -pvmware
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;


2.
授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

如果你想允许用户myuserip192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

 

另外,说明一下,那个'%' 符号好像是代表其他任何计算机,也就是说,除了mysql所在的电脑,其他的都能用用户名和帐号访问。

 

 

备份与恢复

备份一个表:

$mysqldump –uroot –p654321 db_name table_name > file_name_bak.sql

恢复一个表:

$mysql db_name < file_name_bak.sql

 

 

PC电源详解:【上一篇】
MySQL配置文件:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 我的CCNA证书
  • 如何创建共享库
  • 利用IE控件访问Internet
  • VBScript Select Case 语句
  • 修改Grub让多系统和平共处!
  • C#2.0中,SerialPort运行方式
  • 奥森科技万能XP封装
  • 口令攻击的主要方式及相关防护手段
  • 关于C++0x内存模型和序列点的一些思考
  • 搜索广告的成功秘诀(转载)
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.