展开全部

创建用于执行mysql服务程序的帐号:

[root@linuxprobe cmake-2.8.11.2]# cd ..

[root@linuxprobe src]# useradd mysql -s /sbin/nologin

创建数据库程序和文件的目录,并设置目录的所属与所组32313133353236313431303231363533e59b9ee7ad9431333339663366:

[root@linuxprobe src]# mkdir -p /usr/local/mysql/var

[root@linuxprobe src]# chown -Rf mysql:mysql /usr/local/mysql

安装Mysql服务程序(解压与编译过程已省略):

[root@linuxprobe src]# tar xzvf mysql-5.6.19.tar.gz

[root@linuxprobe src]# cd mysql-5.6.19/

[root@linuxprobe mysql-5.6.19]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/var -DSYSCONFDIR=/etc

[root@linuxprobe mysql-5.6.19]# make

[root@linuxprobe mysql-5.6.19]# make install

删除系统默认的配置文件:

[root@linuxprobe mysql-5.6.19]# rm -rf /etc/my.cnf

生成系统数据库(生成信息已省略):

[root@linuxprobe mysql-5.6.19]# cd /usr/local/mysql

[root@linuxprobe mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var

创建配置文件的软连接文件:

[root@linuxprobe mysql]# ln -s my.cnf /etc/my.cnf

将mysqld服务程序添加到开机启动项:

[root@linuxprobe mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@linuxprobe mysql]# chmod 755 /etc/init.d/mysqld

[root@linuxprobe mysql]# chkconfig mysqld on

编辑启动项的配置文件:

[root@linuxprobe mysql]# vim /etc/rc.d/init.d/mysqld

//分别修改第46与47行,basedir为程序安装路径,datadir为数据库存放目录。

basedir=/usr/local/mysql

datadir=/usr/local/mysql/var

重启mysqld服务程序:

[root@localhost mysql]# service mysqld start

Starting MySQL. SUCCESS!

把mysql服务程序命令目录添加到环境变量中(永久生效):

[root@linuxprobe mysql]# vim /etc/profile

//在配置文件的最下面追加:

export PATH=$PATH:/usr/local/mysql/bin

[root@linuxprobe mysql]# source /etc/profile

将mysqld服务程序的库文件链接到默认的位置:

[root@linuxprobe mysql]# mkdir /var/lib/mysql

[root@linuxprobe mysql]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

[root@linuxprobe mysql]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql

[root@linuxprobe mysql]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

初始化mysqld服务程序:

[root@linuxprobe mysql]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS 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):

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

New password: 输入要为root用户设置的数据库密码。

Re-enter new password: 重复再输入一次密码。

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y(删除匿名帐号)

... Success!

Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y(禁止root用户从远程登陆)

... Success!

By default, MySQL comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y(删除test数据库并取消对其的访问权限)

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y(刷新授权表,让初始化后的设定立即生效)

... Success!

All done! If you've completed all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

可以百度搜索Linux就该这么学,第9章 使用Apache服务部署静态网站,里面有部署mysql的资料

本回答由提问者推荐

已赞过

已踩过<

你对这个回答的评价是?

评论

收起

mysql部署 linux_linux 怎么部署mysql数据库相关推荐

  1. mysql远程访问 linux_Linux中开启mysql远程访问功能

    1.确认3306是否对外开放,mysql默认状态下是不开放对外访问功能的.查看的办法如下: # netstat -an | grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0 ...

  2. 使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库

    使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库 原文:使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库 一.背 ...

  3. linux下部署mysql数据库连接_Linux远程部署MySQL数据库详细步骤

    Linux远程部署MySQL数据库,供大家参考,具体内容如下 1.0 安装 yum install lrzsz -y 命令(导入外界压缩包插件(已下载无视即可)) 1.1 将mysql压缩包拷贝到 / ...

  4. python 自动化 mysql 部署_Python自动化管理Mysql数据库教程

    Python自动化管理Mysql数据库教程 发布时间:2020-05-28 11:14:31 来源:51CTO 阅读:238 作者:三月 下面一起来了解下Python自动化管理Mysql数据库教程,相 ...

  5. rancher安装mysql_四、rancher搭建Mysql集群化部署,做到同步备份

    一.Rancher基础镜像查找: 1.基础镜像操作地址:https://hub.docker.com/r/library/mariadb/ 2.选择自己需要的镜像进行搜索,里面有对应版本:也有最新的如 ...

  6. MySQL单机多实例部署详解之------利用mysqld_multi配置实现

    一.mysql多实例的原理 mysql多实例,简单的说,就是在一台服务器上开启多个不同的mysql服务端口(如3306,3307),运行多个mysql服务进程.这些服务进程通过不同的socket监听不 ...

  7. 项目部署mysql安装_Tomcat7+jdk+mysql安装及项目部署

    Tomcat7+jdk+mysql安装及项目部署 1. 下载tomcat7.jdk.mysql apache-tomcat-7.0.42.tar.gz jdk-7u25-linux-i586.gz m ...

  8. Nutch编译及集成eclipse+mysql开发环境的部署总结

    Nutch是一个应用程序,以Lucene为基础实现的搜索引擎应用,Lucene为Nutch 提供了文本搜索和索引的API,Nutch不仅提供搜索,而且还有数据抓取的功能. 1)linux下nutch集 ...

  9. centos 部署mysql5.7_centos7部署MySQL 5.7

    一.部署安装MySQL 注:在安装MySQL前需要卸载掉当前已有的mariadb,然后需要安装gcc环境 1.安装cmake [root@mysql ~]# wget https://github.c ...

最新文章

  1. R语言dataframe分组数据汇总(aggregate and sum):类似于excel的sumif函数
  2. windows下使用Hibernate连接Mycat例子
  3. 遍历文件夹_使用JavaScript遍历本地文件夹的文件
  4. VTK:图像转结构化点用法实战
  5. RMAN SET NEWNAME
  6. 推荐一个硬核嵌入式的原创公众号
  7. Java集合:Map集合
  8. 停机断网也能充话费了!微信和三大运营商打造绿色通道:太方便了!
  9. mysql 搜索正则表达式_mysql必知必会--用正则表达式 进行搜索
  10. 循环减肥c语言,最好的减肥方法
  11. 三星入职测试GSAT(global samsung aptitude test)
  12. Apollo公开课四:感知
  13. 几个 ICON 图标 网站
  14. 只有加法也能做深度学习,北大、华为等提出AdderNet,性能不输传统CNN
  15. 获取新浪开放平台的Access token
  16. ios虚拟服务器降级,升级了iOS 12很后悔,没关系手把手教你如何降级!
  17. c语言按姓名查询出入信息,请问c语言如何实现按姓名查找?
  18. Java实现月工资个人所得税及各保险计算问题(2022年版)
  19. oracle获取指定日期内工作日的天数或节假日天数
  20. ArcEngine二次开发-构建获取栅格图层属性表(ITable)

热门文章

  1. MFC-5动态更新窗体菜单1
  2. 在一个有返回值的方法中,用block回传的解决方法
  3. 关于ASP.NET MVC 项目在本地vs运行响应时间过长无法访问时,解决方法!
  4. EF跨库查询,DataBaseFirst下的解决方案
  5. 完美解决vue项目中弹出框滑动时,内部页面也跟着滑动问题
  6. win10下安装Ubuntu后,启动时没有win10选项解决方法
  7. ora-01033:oracle initialization or shutdown in progress 解决方法
  8. java自定义异常及异常的抛出
  9. 检查传递给Bash脚本的参数数量
  10. 如何基于MySQL及Redis搭建统一的kv存储服务 | 秦波