当前位置: 技术问答>linux和unix
菜鸟求助,安装好MYSQL,运行后出现这样的错误
来源: 互联网 发布时间:2016-11-18
本文导语: 第一次在linux下装软件,系统是red hat版本的,我先说下安装过程吧,不知道有没有在安装的时候出现错误 先从网上下了个mysql-5.1.55.tar.gz,解压到/usr/local/src/mysal,然后./configure到/usr/local/mysal里面,make clean && make &&...
第一次在linux下装软件,系统是red hat版本的,我先说下安装过程吧,不知道有没有在安装的时候出现错误
先从网上下了个mysql-5.1.55.tar.gz,解压到/usr/local/src/mysal,然后./configure到/usr/local/mysal里面,make clean && make && make check && make install,等了好久,全部安装完了。
然后/usr/local/mysal/bin/mysql,就不能运行了,提示说:can't connect to local SQL server though socket ‘/tmp/sql.socket'
我在网上找了很多解决方法,有些看不懂,有些试了没什么用
所以求助各位高手帮忙看下啊,最好能详细点,折腾了一天了,谢谢了!
先从网上下了个mysql-5.1.55.tar.gz,解压到/usr/local/src/mysal,然后./configure到/usr/local/mysal里面,make clean && make && make check && make install,等了好久,全部安装完了。
然后/usr/local/mysal/bin/mysql,就不能运行了,提示说:can't connect to local SQL server though socket ‘/tmp/sql.socket'
我在网上找了很多解决方法,有些看不懂,有些试了没什么用
所以求助各位高手帮忙看下啊,最好能详细点,折腾了一天了,谢谢了!
|
2.1.编译安装
[root@RHEL src]# tar -xzvf mysql-5.1.50.tar.gz
[root@RHEL src]# cd mysql-5.1.50
[root@RHEL mysql-5.1.50]# groupadd mysql
[root@RHEL mysql-5.1.50]# useradd -g mysql -s /bin/false mysql
[root@RHEL mysql-5.1.50]# ./configure --prefix=/usr/local/mysql
[root@RHEL mysql-5.1.50]# make
[root@RHEL mysql-5.1.50]# make install
[root@RHEL mysql-5.1.50]# cd /usr/local/mysql
[root@RHEL mysql]# chown -R mysql .
[root@RHEL mysql]# chgrp -R mysql .
[root@RHEL mysql]# bin/mysql_install_db --user=mysql
[root@RHEL mysql]# chown -R root .
[root@RHEL mysql]# chown -R mysql var
[root@RHEL mysql]# bin/mysqld_safe --user=mysql &
2.2.确认mysql状态 并修改密码
[root@RHEL mysql]# ps -ef | grep mysql
[root@RHEL mysql]# /usr/local/mysql/bin/mysqladmin -u root password 'mysql'
[root@RHEL mysql]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.50 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
2.3.使用官方提供的启动脚本并添加开机启动
[root@RHEL mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
[root@RHEL mysql]# /etc/init.d/mysqld stop
Shutting down MySQL100909 20:06:48 mysqld_safe mysqld from pid file /usr/local/mysql/var/RHEL.pid ended
[确定]
[1]+ Done bin/mysqld_safe --user=mysql
[root@RHEL mysql]# /etc/init.d/mysqld start
Starting MySQL. [确定]
[root@RHEL mysql]# /sbin/chkconfig --add mysqld
[root@RHEL mysql]# /sbin/chkconfig mysqld on
[root@RHEL src]# tar -xzvf mysql-5.1.50.tar.gz
[root@RHEL src]# cd mysql-5.1.50
[root@RHEL mysql-5.1.50]# groupadd mysql
[root@RHEL mysql-5.1.50]# useradd -g mysql -s /bin/false mysql
[root@RHEL mysql-5.1.50]# ./configure --prefix=/usr/local/mysql
[root@RHEL mysql-5.1.50]# make
[root@RHEL mysql-5.1.50]# make install
[root@RHEL mysql-5.1.50]# cd /usr/local/mysql
[root@RHEL mysql]# chown -R mysql .
[root@RHEL mysql]# chgrp -R mysql .
[root@RHEL mysql]# bin/mysql_install_db --user=mysql
[root@RHEL mysql]# chown -R root .
[root@RHEL mysql]# chown -R mysql var
[root@RHEL mysql]# bin/mysqld_safe --user=mysql &
2.2.确认mysql状态 并修改密码
[root@RHEL mysql]# ps -ef | grep mysql
[root@RHEL mysql]# /usr/local/mysql/bin/mysqladmin -u root password 'mysql'
[root@RHEL mysql]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.50 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql>
2.3.使用官方提供的启动脚本并添加开机启动
[root@RHEL mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
[root@RHEL mysql]# /etc/init.d/mysqld stop
Shutting down MySQL100909 20:06:48 mysqld_safe mysqld from pid file /usr/local/mysql/var/RHEL.pid ended
[确定]
[1]+ Done bin/mysqld_safe --user=mysql
[root@RHEL mysql]# /etc/init.d/mysqld start
Starting MySQL. [确定]
[root@RHEL mysql]# /sbin/chkconfig --add mysqld
[root@RHEL mysql]# /sbin/chkconfig mysqld on