linux安装mysql
2016-01-18 15:41
453 查看
linux安装mysql。
升级mysql到5.7,这篇文章中有详细介绍,可参照。
一、安装文件
mysql官网,我是没有找到怎么下载。所以,我上传到百度云上供大家免费下载。二、安装
①、上传文件
使用Linux的sz、rz命令可以上传,也可以使用filezila工具上传,上传完毕后,见文件如下:②、清理mysql
这一步非常关键,保证在安装mysql之前,Linux上对mysql是干净的,否则经常会导致安装失败。升级mysql到5.7,这篇文章中有详细介绍,可参照。
③、安装MySQL-server
[root@iZ23gsv94suZ soft]# rpm -ivh MySQL-server-5.7.4_m14-1.el6.x86_64.rpm Preparing... ########################################### [100%] find: `/var/lib/mysql': No such file or directory 1:MySQL-server ########################################### [100%] 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. Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com[/code]
tips:
注意’/root/.mysql_secret’这个文件。
注意no other statement but 'SET PASSWORD' will be accepted。④、安装MySQL-client
rpm -ivh MySQL-client-5.7.4_m14-1.el6.x86_64.rpm五、启动mysql服务
[root@iZ23gsv94suZ mysql]# service mysql start Starting MySQL. SUCCESS!⑥、连接mysql
[root@iZ23gsv94suZ mysql]# mysql -uroot -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
密码在“/root/.mysql_secret”这个文件中。⑦、修改默认密码
mysql> use mysql ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
此时出现了错误,我们需要:mysql> set password=password("root"); Query OK, 0 rows affected (0.00 sec)⑧、修改密码
mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> update user set password=PASSWORD("lixiaoli") where user="root"; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
哈哈,请不要相信我的密码是“lixiaoli”,我只不过是喜欢她而已!没错,就是李孝利。⑨、开启防火墙
为了保证Linux的安全期间,我们需要开启防火墙,同时,将mysql的3306端口释放出去。
请注意先关闭防火墙service iptables stopvim /etc/sysconfig/iptables
打开以上文件,增加如下内容:-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPTservice iptables save service iptables start⑩、开启远程访问权限
mysql> grant all privileges on *.* to root@'192.168.44.11' identified by "lixiaoli"; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
“grant all privileges”:开启所有权限,包括增删改查了!
“.”:当有数据库的数据表。
“root”:user名了!
“‘192.168.44.11’”自然就是对那一台机器开启远程权限了。
“‘lixiaoli’”:自然是对应的密码了相关文章
Linux上更改mysql数据库目录
mysql之my.cnf
linux的crontab定时服务备份mysql数据
升级mysql到5.7
相关文章推荐
- Linux环境下提升普通用户权限(sudo)
- linux 怎么样复制文件夹内所有文件到另一个文件夹?
- Linux meld安装
- Linux学习netstat
- linux常用基本命令
- linux 增加sudo权限
- linux-0.12/boot/bootsect.S下的常见问题
- linux下后台启动weblogic服务(还有些注意事项)
- Centos 安装Rsync笔记
- centos 服务器装与python34源码安装
- CentOS/RHEL6.5中使用WordPress快速建站
- 基于阿里云centos 6.5 mysql安装配置,以及mysql备份配置
- How to kill a process on a port on linux 怎么杀死 关掉一个端口
- linux下如何自动生成Makefile文件
- Common administrative commands in Red Hat Enterprise Linux 5, 6, and 7
- linux下为php添加curl扩展的方法
- Linux 删除文件夹和文件的命令
- linux epoll 模型
- 安卓开发linux内核驱动
- Linux下百度云盘报 获取bdstoken失败