一、redhat下mysql的安装
1、安装可能会出现以下错误:

2、这些mysql的安装包都在redhat光盘里可以找到。
依次按照下面的顺序安装,就会成功。
sudo rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
sudo rpm -ivh mysql-5.0.77-4.el5_5.4.i386.rpm
sudo rpm -ivh perl-DBD-MySQL-3.0007-2.el5.i386.rpm
sudo rpm -ivh mysql-server-5.0.77-4.el5_5.4.i386.rpm
3、出现如下错误,可能是没有root权限导致的:
error: can't create transaction lock on /var/lib/rpm/__db.000
二、redhat下mysql的使用
1、mysql的启动、登录并并设置密码:
$sudo /etc/init.d/mysqld start
$mysqladmin -u rootpassword "123456"
[root@shiyue5~]# mysql -u root -p
$mysql>create database shiyue;
3、 配置客户端连接
mysql>use mysql;
mysql>grant all on *.* to root@"%" identified by "123456";
通过对1042问题代码的查询,得出编辑/etc/my.cnf文件,在[mysqld]内添加一行skip-name-resolve
在/etc/目录下如没有my.cnf配置文件,则请到/usr/share/mysql/下找到*.cnf文件,拷贝其中的一个到/etc/并改名为my.cnf
[root@shiyue5~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
[root@shiyue5~]# vi /etc/my.cnf
#Example MySQL config file for medium systems.
#
# Thisis for a system with little memory (32M - 64M) where MySQL plays
# animportant part, or systems up to 128M where MySQL is used together with
#other programs (such as a web server)
#
#MySQL programs look for option files in a set of
#locations which depend on the deployment platform.
# Youcan copy this option file to one of those
#locations. For information about these locations, see:
#http://dev.mysql.com/doc/mysql/en/option-files.html
#
# Inthis file, you can use all long options that a program supports.
# Ifyou want to know which options a program supports, run the program
# withthe "--help" option.
# Thefollowing options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
# Herefollows entries for some specific programs
# TheMySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-external-locking
key_buffer_size= 16M
max_allowed_packet= 1M
table_open_cache= 64
sort_buffer_size= 512K
net_buffer_length= 8K
read_buffer_size= 256K
read_rnd_buffer_size= 512K
myisam_sort_buffer_size= 8M
skip-name-resolve
#Don't listen on a TCP/IP port at all. This can be a security enhancement,
# ifall processes that need to connect to mysqld run on the same host.
# Allinteraction with mysqld must be made via Unix sockets or named pipes.
"/etc/my.cnf"145L, 4700C written
最后推荐文章:
http://tech.sina.com.cn/s/s/2008-12-24/09322685706.shtml