如何安装MYSQL

如何安装MYSQL,第1张

使用yum安装mysql数据库的软件包 [root@xuegod63 ~]# yum -y install mariadb-server mariadb 。

注:  mariadb-server   #MariaDB数据库 mariadb      # MariaDB服务器Linux下客户端 。

注:从centos7系统开始,系统中自带的mysql数据库变成了mariadb-server,mariadb-server和mysql *** 作上一样。mariadb-server是mysql的一个分支。

启动数据库服务[root@xuegod63 ~]# systemctl start  mariadb  #启动MariaDB服务。[root@xuegod63 ~]# systemctl enable  mariadb  #设置开启自动启动MariaDB服务。

安装完mariadb-server后,运行mysql_secure_installation去除安全隐患,[root@xuegod63 ~]# mysql_secure_installation #进入安全配置导向。

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQLSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current,password for the root user. If you've just installed MySQL, and,you haven't set the root password yet, the password will be blank,,so you should just press enter here.Enter current password for root (enter for none):   #初次运行直接回车,因为root用户没有密码。

OK, successfully used password, moving on,Setting the root password ensures that nobody can log into the MySQL,root user without the proper authorisation.,Set root password? [Y/n] Y #是否设置root用户密码,输入Y。

New password: 123456   #新密码123456,Re-enter new password: 123456,Password updated successfully!Remove anonymous users? [Y/n] Y   #是否删除匿名用户,生产环境建议删除,所以直接回车或Y。

Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y  #是否禁止root远程登录,根据自己的需求选择Y/n并回车建议禁止。

Success!By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] Y   #是否删除test数据库,直接回车或Y。

MySQL是一个跨平台开源的关系型数据库管理系统,多用于中小型网站或系统的开发。软件开发使用数据库技术可以方便实现数据的共享,减少数据的冗余,也方便统一对数据进行 *** 作和控制。MySQL相对于Oracle、DB2等大型数据库具有体积小、速度快、成本低的特点,这些特性使得MySQL在开源世界大受欢迎。下面我带领大家去学习mySQL的下载及安装。

工具/材料

Windows *** 作系统

MySQL有两个不同的版本, MySQL Community Server 是免费的社区版,MySQL Enterprice Server是企业版服务器,该版本需要付费,官方会提供技术支持。小型的软件开发或者自己学习使用,我们下载免费的社区版即可。我们在搜狗搜索框中输入mysql官网,进入到如下的页面,点击DOWNLOADS-->Community。

我们在跳转的页面选择MySQL Community Downloads下方的DOWNLOAD按钮,选择Windows版本的安装包,我们选择MSI格式的安装包,点击Go to Download按钮,如下图所示。安装包只能选择32位的,即便本机是64位的 *** 作系统也没有关系,图中有两个安装版本,第一个版本在线安装,第二个下载的版本离线安装。我们在安装的过程中不需要登录,选择No thanks, just start my download。

安装包下载完成后,我们点击右键进行安装,安装过程中License Agreement选择I accept the licence terms。安装类型选择Server only,执行过程如下图所示。

安装过程中,我们可以看到默认端口号是3306,接下来我们需要输入密码,密码不要设置太弱。安装过程中我们勾选开机自启动,如下图所示。执行安装我们选择Execute,然后便是开始等待安装即可。

安装完成后,我们找到本机的MySQL的客户端工具,这是一个命令行工具,可以执行sql命令,但不能用于复杂的开发工作,使用这个工具可以帮我们快速入门mysql数据库。

我们打开这个客户端软件,输入完密码后,便可以看到光标处的mysql>, 输入show databases可以看到默认的数据库有哪些。其他的sql命令也很多,我们便不再一一列举了。

特别提示

安装过程中可能会提示Microsoft Visual C++ 2015 没有安装之类的,我们在线等待安装完成即可,这个时间可能有点久,请耐心等待。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/9722730.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存