温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql二进制包使用实例分析

发布时间:2022-02-16 09:49:13 来源:亿速云 阅读:89 作者:iii 栏目:开发技术

这篇“mysql二进制包使用实例分析”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“mysql二进制包使用实例分析”文章吧。

mysql二进制包使用实例分析
1.安装之前,先创建mysql用户
[root@linuxprobe_nfs ~]# useradd mysql -s /sbin/nologin -M[root@linuxprobe_nfs ~]# id mysqluid=500(mysql) gid=500(mysql) groups=500(mysql)
2.软件包的下载及解压
[root@linuxprobe_nfs ~]# mkdir /home/chenfan/tools  -p[root@linuxprobe_nfs ~]# cd /home/chenfan/tools在http://dev.mysql.com/downloads/mysql/官网上下载mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs tools]# lsmysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs tools]# tar zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz[root@linuxprobe_nfs tools]# lsmysql-5.5.32-linux2.6-x86_64  mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@linuxprobe_nfs local]# mv mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql-5.5.32  ###免编译安装[root@linuxprobe_nfs local]# cd /usr/local[root@linuxprobe_nfs local]# ln -s mysql-5.5.32  mysql  ###此处的软链接为了版本升级提供了便利
3.初始化数据库
[root@linuxprobe_nfs local]# mysql/scripts/mysql_install_db  --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/  --user=mysql###此处如果初始化发生错误,删除data目录下的内容,rm -fr  mysql/data/*,重新初始化。
4.生成MySQL配置文件
[root@linuxprobe_nfs local]# cd mysql[root@linuxprobe_nfs mysql]# cp support-files/my-small.cnf  /etc/my.cnf
5.授权管理文件
[root@linuxprobe_nfs ~]# chown -R mysql:mysql /usr/local/mysql/[root@linuxprobe_nfs ~]# ls -ld /usr/local/mysql/drwxr-xr-x. 13 mysql mysql 4096 Jun 24 17:21 /usr/local/mysql/
6.设置科学的启动方式
[root@linuxprobe_nfs mysql]# cp support-files/mysql.server  /etc/init.d/mysqld[root@linuxprobe_nfs mysql]# chmod +x /etc/init.d/mysqld[root@linuxprobe_nfs mysql]# /etc/init.d/mysqld startStarting MySQL... SUCCESS!
[root@linuxprobe_nfs mysql]# chkconfig --add mysqld[root@linuxprobe_nfs mysql]# chkconfig mysqld on[root@linuxprobe_nfs mysql]# chkconfig --list mysqldmysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off### 设置开机自启动mysql
7.配置MySQL环境变量
[root@linuxprobe_nfs mysql]# echo 'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile[root@linuxprobe_nfs mysql]# source /etc/profile[root@linuxprobe_nfs mysql]# echo $PATH/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin###此处PATH路径的设置为了后续mysql命令的使用
8.mysql登陆与密码设置
[root@linuxprobe_nfs mysql]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.32 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

[root@linuxprobe_nfs mysql]# mysqladmin  -uroot password 'chenfan'###密码的设置[root@linuxprobe_nfs mysql]# mysql -uroot -pEnter password: chenfan###交互式登陆###至此完成MySQL的全部初始安装与配置

以上就是关于“mysql二进制包使用实例分析”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI