CentOS7 64位安装mysql5.7(linux)

1 首先安装完成jdk,方法如上一篇文章

   如果wget命令无效则输入如下指令安装(command not found):

yum -y install wget


2 安装mysql -yum源,可以自己下载,下载地址(百度搜索mysql yum源):

  https://dev.mysql.com/downloads/repo/yum/

  下载完成后可以透过远程软件传到linux文件夹中,也可以用wget自行在linux环境下载


3 安装yum源,输入命令

[root@localhost soft]# yum localinstall mysql57-community-release-el7-11.noarch.rpm 
已加载插件:fastestmirror
正在检查 mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
mysql57-community-release-el7-11.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql57-community-release.noarch.0.el7-11 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package           架构   版本   源                                        大小
================================================================================
正在安装:
 mysql57-community-release
                   noarch el7-11 /mysql57-community-release-el7-11.noarch  31 k

事务概要
================================================================================
安装  1 软件包

总计:31 k
安装大小:31 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : mysql57-community-release-el7-11.noarch                                                                                                            1/1 
  验证中      : mysql57-community-release-el7-11.noarch                                                                                                            1/1 

已安装:
  mysql57-community-release.noarch 0:el7-11                                                                                                                            

完毕!
4 下载并安装mysql,输入命令,看到如下图

 a. 安装之前可以输入如下命令,检查yum源是否安装成功

 yum repolist enabled | grep "mysql.*-community.*"
b.输入如下命令开始安装
yum install mysql-community-server


5. 启动mysql

service mysqld start  //启动mysql

chkconfig --add mysqld  //加入系统服务

chkconfig mysqld on  //开机自动启动

systemctl start mysqld       #启动mysql
systemctl enable mysqld      #设置开机启动
systemctl daemon-reload



6.登录mysql

mysql安装成功后会生成一个随机密码,存放在/var/log/mysqld.log

grep 'temporary password' /var/log/mysqld.log
2017-06-13T14:30:34.802886Z 1 [Note] A temporary password is generated for root@localhost: dsA&abJxe7Ju
mysql -uroot -p  #输入上面获取到的初始密码进入mysql修改密码

打开找到密码并登陆

set password = password('root') 

如果不允许设置简单密码,则输入这两句,第一句表示可以设定纯数字或字母,第二句表示密码长度最低4位

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=4;
Query OK, 0 rows affected (0.01 sec)
set password=password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)

7.开启 允许mysql远程登录(mysql默认只能本地登录)

登录mysql后输入如下命令

mysql> grant all privileges on *.* to 'root' @'%' identified by 'root';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;

8.开启Linux 3306对外访问的端口

[root@localhost /]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@localhost /]# /etc/rc.d/init.d/iptables save     #将设置保存到防火墙内

9.配置默认编码为UTF-8

修改/etc/my.cnf文件,在[mysqld]下面配置:

[mysqld]
character_se_server=utf8
init_connect='SET NAMES utf8'

也可以在mysql窗口内输入:
  1. mysql> SET character_set_client = utf8 ;  
  2. mysql> SET character_set_connection = utf8 ;   
  3. mysql> SET character_set_database = utf8 ;   
  4. mysql> SET character_set_results = utf8 ;    
  5. mysql> SET character_set_server = utf8 ;   
  6.  
  7. mysql> SET collation_connection = utf8 ;  
  8. mysql> SET collation_database = utf8 ;   
  9. mysql> SET collation_server = utf8 

10.尝试远程连接,完成mysql安装






按需引入<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Ant Design Vue 纯HTML项目示例</title> <!-- 引入Ant Design Vue的CSS --> <link rel="stylesheet" href="https://unpkg.com/ant-design-vue@3.2.21/dist/antd.css"> <!-- 引入Ant Design X Vue的CSS --> <link rel="stylesheet" href="https://unpkg.com/ant-design-x-vue@1.0.0/dist/antdx.css"> <!-- vue3引入 --> <script src="https://unpkg.com/dayjs/dayjs.min.js"></script> <script src="https://unpkg.com/dayjs/plugin/customParseFormat.js"></script> <script src="https://unpkg.com/dayjs/plugin/weekday.js"></script> <script src="https://unpkg.com/dayjs/plugin/localeData.js"></script> <script src="https://unpkg.com/dayjs/plugin/weekOfYear.js"></script> <script src="https://unpkg.com/dayjs/plugin/weekYear.js"></script> <script src="https://unpkg.com/dayjs/plugin/advancedFormat.js"></script> <script src="https://unpkg.com/dayjs/plugin/quarterOfYear.js"></script> <!-- vue3 --> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> <!-- antdv --> <script src="https://cdn.jsdelivr.net/npm/ant-design-vue@4.2.6/dist/antd.min.js"></script> <!-- antdxv --> <script src="https://cdn.jsdelivr.net/npm/ant-design-x-vue@1.2.7/dist/index.umd.min.js"></script> </head> <body> <div id="app"></div> <script> const { createApp, ref, computed } = Vue; const { Button } = antd; const { Bubble, XProvider } = antdx; createApp({ template: ` <AXProvider :theme="{ algorithm: myThemeAlgorithm, }"> <div :style="{ padding: &#39;24px&#39;, backgroundColor: bgColor, }"> UMD <AXBubble content="hello bubble"></AXBubble> <AButton type="primary" @click="setLightTheme">Light</AButton> <AButton type="primary" @click="setDarkTheme">Dark</AButton> </div> </AXProvider> `, setup() { const { theme } = antd; const bgColor = ref("white"); const myThemeAlgorithm = ref(theme.defaultAlgorithm); const setLightTheme = () => { myThemeAlgorithm.value = theme.defaultAlgorithm; bgColor.value = "white"; }; const setDarkTheme = () => { myThemeAlgorithm.value = theme.darkAlgorithm; bgColor.value = "#141414"; }; return { myThemeAlgorithm, bgColor, setLightTheme, setDarkTheme }; } }) .use(XProvider) .use(Button) .use(Bubble) .mount("#app"); </script> <style> .container { max-width: 1200px; margin: 24px auto; padding: 0 16px; } .search-form { margin-bottom: 24px; padding: 16px; background-color: #f5f5f5; border-radius: 4px; } .user-table { margin-top: 16px; } .mb-6 { margin-bottom: 24px; } .mt-2 { margin-top: 8px; } </style> </body> </html>
07-17
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值