linux rathat5 安装mysql5.1 步骤

本文详细介绍了在Linux环境下MySQL的安装过程,并分享了解决安装后无法通过socket连接本地MySQL服务器的问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装linux
2.安装mysql,安装本人经验下载二进制解压版安装比较合适
http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.54-linux-i686-glibc23.tar.gz
3.将解压之后将mysql-5.1.54-linux-i686-glibc23.tar.gz 拷到/user/local[quote]必须这样放在当前用户目录在后面步骤会出现问题[/quote]

mv mysql-5.1.54-linux-i686-glibc23 /usr/local/

4.解压gz包到当前目录
[code="java"]
# tar -vxf mysql-5.1.54-linux-i686-glibc23.tar.gz
[/code]
5.在这一步执行scripts/mysql_install_db --user=mysql的时候如果发现出现db.MYI错误 您就看看你mysql是否拷到/usr/local中
[code="java"]

# groupadd mysql
# useradd -g mysql mysql
# ln -s mysql-5.1.54-linux-i686-glibc23 mysql
# cd mysql
# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h esunny password 'new-password'

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

[/code]
6.到目前为止所有要安装的步骤都搞定了,接下来我们登陆数据库看看
[code="java"]
# bin/mysql -uroot
[/code]
结果出现错误:
[code="java"]
# bin/mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[/code]
出现上述错误后,我想了很多办法去解决,但是都没解决应该就是权限的问题,但是我设置tmp权限后还是报错在网站找了很多资料都没结果后来看到一个高手


I got a error message whene I completed the installation and try to start the mysql:
#mysql
ERROR 2002:Can't connect to local MySQL server through cocket '/tmp/mysql.sock'(2)

How can I solve this problem?


解决方法如下:
第一种方法:You do not have mysql running when you tried to access the mysql commandline. You first need to run

# /usr/local/etc/rc.d/mysql-server.sh start

and then you will be able to connect to mysql.

第二种方式:
#/usr/local/bin/mysqld_safe &
然后:
#mysql



肯定一切ko


我采用了第二种办法解决问题的
其实不是什么解决方案,知识启动 mysql而已
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值