Linux-CentOS6.5-MySQL安装

折腾了下午+晚上,终于在Linux成功安装上MySQl。

安装过程中最大的帮助

https://blog.csdn.net/fly43108622/article/details/48136659

 

1、下载的mysql-5.6.41-linux-glibc2.12-x86_64.tar.gz;

2、将其放入想要放入的位置,建议系统中有专门存放安装包的地方;

3、解压

tar -zxvf mysql-5.6.41-linux-glibc2.12-x86_64.tar.gz -C /usr/mysql

4、此处提前在mysql/bin/下 

yum install libaio

关于libaio,只百度到Linux下原生异步IO接口libaio,具体不清楚...

5、** mysql_install_db 在 mysqlXX/scripts/包下

./scripts/mysql_install_db --user=mysql --basedir=/usr/mysql/mysql-5.6.41-linux-glibc2.12-x86_64/ --datadir=/data/mysql/

会打印一大推日志,没有看到[ERROR],说明执行成功

6、修改my.cnf(也可以借助远程文件程序,eg:WinSCP)

将解压出来的mysql下 /support-files/my-default.conf 复制到/etc/下,并且覆盖my.cnf

cp support-files/my-default.cnf /etc/my.cnf

添加以下内容

basedir = /usr/local/mysql

datadir = /data/mysql

port = 3306

7、将解压出来的mysql下 /support-files/mysql.server复制到/etc/init.d/下,并且改名为mysqld

文件权限为 755

chmod 755 /etc/init.d/mysqld

8、添加到自启动服务

chkconfig --add mysqld

查看是否添加成功

chkconfig --list mysqld

9、service mysql start/stop/..可以使用

10、

vim /etc/profile

   在/etc/profile添加 以下内容


MYSQL_HOME=/usr/mysql/mysql-5.6.41-linux-glibc2.12-x86_64

export PATH=$MYSQL_HOME/bin:$PATH

 使得新添加的内容生效,有可能需要重新启动系统

source /etc/profile

11、有关mysql密码登录再进行解决(百度)...

过程中遇到的错误:

1、未修改文件权限

2、3306端口号被占用(由于多次失败,导致的)

查看端口号:ps -aux | grep mysql

查看所有的进程和端口使用情况:netstat -apn | grep 3306

找到后,使用kill杀死:kill 端口号

3、mysql命令没有找到

一种方法:进入bin/ - [root@localhost bin]# ./mysql

另一种方法(建议)

vim /etc/profile

   在/etc/profile添加 以下内容


MYSQL_HOME=/usr/mysql/mysql-5.6.41-linux-glibc2.12-x86_64

export PATH=$MYSQL_HOME/bin:$PATH

 使得新添加的内容生效,有可能需要重新启动系统

source /etc/profile

 

 

猜你喜欢

转载自blog.csdn.net/m0_37461645/article/details/82732467
今日推荐