您的位置:首页 > 博客中心 > 数据库 >

Linux中MySQL5.5解压版普通用户安装

时间:2022-03-14 05:19

#查看本机mysql 安装路径

[hadoop@SY-0134 toolkit]$ rpm -qa|grep -i mysql

[hadoop@SY-0134 toolkit]$ whereis mysql

mysql: /usr/lib/mysql /usr/share/mysql

环境Centos, 经过检验,上述目录实际没有mysql的安装,只是有一些lib包和帮助语言包。

 

#解压mysql-5.5.39-linux2.6-i686.tar.gz 到/lab/mysql5.5目录

 #配置mysql5.5 conf文件

cp support-files/my-medium.cnf /data/my.cnf

 

#修改my.cnf文件,配置Mysql数据存储目录

在mysqld下面添加:datadir=/lab/mysql5.5/data

 

#配置目录用户访问权限:

[hadoop@SY-0134 mysql5.5]$ scripts/mysql_install_db -user=hadoop

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 SY-0134 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 at http://bugs.mysql.com/

  

#设置mysqld服务随服务器启动

#切换到root用户

cp support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod 700 /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig -–level 2345 mysqld on

 [root@SY-0134 mysql5.5]# chkconfig --list mysqld

 mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

 

#修改/etc/rc.d/init.d/mysqld文件设置,制定Mysql安装目录和数据存储目录

basedir=/lab/mysql5.5

datadir=/lab/mysql5.5/data

 

#启动mysqld服务

service mysqld start

 

#查看3306端口是否打开。要注意在防火墙中开放该端口

netstat -atln

 

权限放开 ,使得普通用户也能启动mysql服务

[root@SY-0134 mysql5.5]# chmod a+wrx /etc/init.d/mysqld

MySQL问题解决:-bash::command not found

解决办法,将mysql命令创建软连接到/usr/bin中:

ln -s /lab/mysql5.5/bin/mysql  /usr/bin

参考网址:

 

本类排行

今日推荐

热门手游