linux离线安装mysql
1.上传压缩包
2.解压
3.查看已安装的mysql rpm -qa |grep mysql
4.删除已安装的mysql rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
5.安装我们自己的rpm包 rpm -ivh *.rpm
6.设置mysql的root密码,首先后台启动mysql cd /usr/lib
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
7.进入mysql终端:mysql -u root mysql
8.设置密码: UPDATE user SET Password=PASSWORD('admin') where USER='root' and host='root' or host='localhost';
9.刷新权限:FLUSH PRIVILEGES;
10.退出mysql exit;
11.重启mysql:/etc/init.d/mysql restart
12 重新使用新密码登陆 mysql -uroot -p
- 重新设置一下密码:SET PASSWORD = PASSWORD('admin');
13.开启远程登陆:Grant all privileges on . to 'root'@'%' identified by 'admin' with grant option;
14.刷新权限列表 :FLUSH PRIVILEGES;
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.
You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.
Also, the account for the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test database.
This is strongly recommended for production servers.
See the manual for more instructions.
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings
卸载mysql
停止mysql服务 service mysql stop
查看所有mysql的安装包 rpm -qa | grep -i mysql
卸载所有mysql的安装包 rpm -e MySQL-test-5.6.17-1.el6.x86_64 MySQL-shared-5.6.17-1.el6.x86_64 MySQL-devel-5.6.17-1.el6.x86_64 MySQL-shared-compat-5.6.17-1.el6.x86_64 MySQL-embedded-5.6.17-1.el6.x86_64 MySQL-server-5.6.17-1.el6.x86_64 MySQL-client-5.6.17-1.el6.x86_64 --nodeps
查看是否卸载干净 rpm -qa | grep -i mysql
查看哪里还有mysql的文件夹 whereis mysql
删掉 rm -rf /usr/lib64/mysql
删掉 rm -rf /usr/my.cnf
删掉 rm -rf /root/.mysql_secret
删掉 rm -rf /var/lib/mysql
mysql因为服务器硬件原因,主要是内存不足,导致mysql进程很容易宕机死掉的解决办法,mysql报出错误 SQLSTATE 08S01,communication failure
解决方案:
前天,想测试一下小站-095网址导航(http://www.095.me)的连接速度,在网上找了下,找到这个测试网站速度的网站,http://www.webkaka.com/webCheck.aspx,
但测试后就出问题了,数据库连接不上,小站也找不开了。于是想,会不会是因为硬件太低,所于数据库出现问题,启动了不。
于是到/var/log查看了数据库的日志,看到了Got an error: Connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock',在网上找了了,发现很多帖都是你抄我我抄你的,不过也没有关系,有效就行了。但试了很多个都不行。后来看到一位大牛的说增加swap空间可以解决这个问题,于是按他所说的去做了。果然,再次使用测速网站去测试打开网速也不会出现同样的问题了。
解决方法如下:
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo swapon /swapfile
sudo vi /etc/fstab
添加"/swapfile swap swap defaults 0 0"到末尾,不包括引号,如果不会使用vi,请自己网上查资料。
保存,退出,重新启动。
文章来源: www.jianshu.com,作者:百忍成金的虚竹,版权归原作者所有,如需转载,请联系作者。
原文链接:www.jianshu.com/p/00261980bc5f
- 点赞
- 收藏
- 关注作者
评论(0)