linux安装mysql失败_Linux安装MySQL遇到的问题

安装:

https://www.cnblogs.com/fnlingnzb-learner/p/5830622.html

https://www.cnblogs.com/xinjing-jingxin/p/8025805.html

https://www.cnblogs.com/xxoome/p/5864912.html

https://www.cnblogs.com/bookwed/p/5896619.html

1、解压到当前目录

tar -xvzf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz

2、复制到mysql目录

cp  mysql-5.6.42-linux-glibc2.12-x86_64 /usr/local/mysql -r

3、添加系统mysql组和mysql用户

groupadd mysql和useradd -r -g mysql mysql

4、安装数据库

进入安装mysql软件目录:执行命令 cd /usr/local/mysql

修改当前目录拥有者为mysql用户:执行命令 chown -R mysql:mysql ./

安装数据库:执行命令 ./scripts/mysql_install_db --user=mysql

修改当前目录拥有者为root用户:执行命令 chown -R root:root ./

修改当前data目录拥有者为mysql用户:执行命令 chown -R mysql:mysql data

5、安装完成

开启远程连接:

https://www.cnblogs.com/pqy521/p/7111268.html

一、MySQL5.6 Using a password on the command line interface can be insecure解决方法;

原因:

官方网址:http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html

MySQL users shoulduse the following guidelines to keep passwords secure.

When you run a client program to connect to the MySQL server, it is inadvisableto specify your password in a way that exposes it to discovery by other users.The methods you can use to specify your password when you run client programsare

listed here, along with an assessment of the risks of each method. Inshort, the safest methods are to have the client program prompt for thepassword or to specify the password in a properly protected option file.

翻译过来大意是在命令行下如果要使用密码可以在执行命令后的提示输入里输入密码,或者在指定的安全文件内指定密码;那安全文件时哪个呢?文档对此给出了答案:

Store your passwordin an option file. For example, on Unix, you can list your password in the[client] section of the .my.cnf file in your home directory:

1.针对mysql:

mysql -u root -pPASSWORD改成mysql -u root -p 在输入密码即可.

2.mysqldump就比较麻烦了,通常都写在scripts脚本中;

解决方法:

对于mysqldump 要如何避免出现(Warning:Using a password on the command line interface can be insecure.) 警告信息呢?

vim /etc/mysql/my.cnf

[mysqldump]

user=your_backup_user_name

password=your_backup_password

修改完配置文件后, 只需要执行mysqldump 脚本就可以了;备份脚本中不需要涉及用户名密码相关信息;

我用的是第一种,第二种没试过。

二、Centos下Mysql因为pid文件启动失败问题解析

>service mysql start

Starting MySQL.. ERROR! The server quit without updating PID file (/var/run/mariadb/mariadb.pid).

cat /var/log/mariadb/mariadb.log

...171112 11:18:38 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mariadb/mariadb.pid' (Errcode: 2)

171112 11:18:38 [ERROR] Can't start server: can't create PID file: No such file or directory

我看了下,的确文件、文件都不存在,我的解决办法是:

> mkdir /var/run/mariadb> chown mysql.mysql /var/run/mariadb/

最后,重启MySQL,成功。

>service mysql start

Starting MySQL.. SUCCESS!

三、mysql.sock问题(解决方法很多,这只是其中一个)

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

这是可以由于系统默认的文件位置和文件位置不一致,解决办法找到文件创建软链接

find / -name mysql.sock

ln-s /var/lib/mysql/mysql.sock /tmp/mysql.sock

四、   FATAL ERROR: please install the following Perl modules before executing scripts/mysql_install_db:

Data::Dumper

#解决方法:

yum install-y perl-Data-Dumper

五、mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.

https://blog.csdn.net/qq_32331073/article/details/76229420

六、MySQL: Starting MySQL….. ERROR! The server quit without updating PID file解决办法

https://blog.csdn.net/orichisonic/article/details/47021379

七、如果是阿里云服务器 需要注意

5eb8203d4253380cff9981c34faaf9a6.png

这地方也需要开启相关的端口,不然仅仅是linux开启防火墙不行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值