您的位置:新葡亰496net > 网络数据库 > 新葡亰496net:04_软件设置和卸载

新葡亰496net:04_软件设置和卸载

发布时间:2019-08-23 13:11编辑:网络数据库浏览(75)

    漫天文字见 

    Ubuntu

    centos 服务器 mysql 安装,centosmysql

    全方位文字见 

     

    CentOS 7的yum源中从不例行安装mysql时的mysql-sever文件,须要去官英特网下载

    wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
    yum localinstall mysql-community-release-el7-5.noarch.rpm
    yum install mysql-community-server
    

    提示 Is this ok [y/d/N] 时输入 y

    接下来初始联网下包更新。。

     

    成功安装之后重启mysql服务

    service mysqld restart
    

    初次安装mysql是root账户是从未密码的

    设置密码的法子

    mysql -uroot
    mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
    mysql> exit
    

      

    服务器 mysql 安装,centosmysql 全体文字见 CentOS 7的yum源中从未正规安装mysql时的mysql-sever文件,须要...

    要使用yum 安装mysql,要采用mysql的yum旅馆,先从官方网址下载适合您系统的旅社

     

    apt-get

    • 更新源服务器列表
    sudo vi /etc/apt/sources.list
    
    • 创新完服务器列表后要求更新下源
    sudo apt-get update 更新源
    sudo apt-get install package 安装包
    sudo apt-get remove package 删除包
    sudo apt-cache search package 搜索软件包
    sudo apt-cache show package 获取包的相关信息,如说明、大小、版本等
    sudo apt-get install package --reinstall 重新安装包
    sudo apt-get -f install 修复安装
    sudo apt-get remove package --purge 删除包,包括配置文件等
    sudo apt-get build-dep package 安装相关的编译环境
    sudo apt-get upgrade 更新已安装的包
    sudo apt-get dist-upgrade 升级系统
    sudo apt-cache depends package 了解使用该包依赖那些包
    sudo apt-cache rdepends package 查看该包被哪些包依赖
    sudo apt-get source package 下载该包的源代码
    sudo apt-get clean && sudo apt-get autoclean 清理无用的包
    sudo apt-get check 检查是否有损坏的依赖
    

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

    CentOS 7的yum源中从不例行安装mysql时的mysql-sever文件,供给去官互连网下载

    deb包安装

    安装deb软件包命令: sudo dpkg -i xxx.deb
    删除软件包命令: sudo dpkg -r xxx.deb
    连同配置文件一起删除命令: sudo dpkg -r --purge xxx.deb
    查看软件包信息命令: sudo dpkg -info xxx.deb
    查看文件拷贝详情命令: sudo dpkg -L xxx.deb
    查看系统中已安装软件包信息命令: sudo dpkg -l
    重新配置软件包命令: sudo dpkg-reconfigure xxx
    
    • 浏览已安装的程序
    dpkg --list
    
    • 卸载程序和全数配置文件
    sudo apt-get --purge remove <programname>
    
    • 只卸载程序
    sudo apt-get remove <programname>
    

    centos 6.7 对应的是mysql57-community-release-el6-7.noarch.rpm

    wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
    yum localinstall mysql-community-release-el7-5.noarch.rpm
    yum install mysql-community-server
    

    原码安装

    1. 解压缩源代码包
    2. cd dir
    3. ./configure
    检测文件是否缺失,创建Makefile,检测编译环境
    4. make
    编译源码,生成库和可执行程序
    5. sudo make install
    把库和可执行程序,安装到系统路径下
    6. sudo make distclean
    删除和卸载软件 
    

    注意:

    sudo aptitude show softname
    
    1. 翻看软件新闻,是不是安装、软件大小等等新闻
    2. 该命令第一遍选择时索要设置:sudo apt-get install aptitude
    sudo aptitude install softname
    
    1. aptitude还足以用来设置软件

    接下来安装一下以此库房列表

    提示 Is this ok [y/d/N] 时输入 y

    CentOS

    sudo rpm -Uvh mysql57-community-release-el6-7.noarch.rpm

    下一场最初联网下包更新。。

    使用RPM包安装mysql

    安装情状:Centos6.7桌面版

    • 下载
    wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.48-1.el6.x86_64.rpm
    wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.48-1.el6.x86_64.rpm
    wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-devel-5.5.48-1.el6.x86_64.rpm
    
    • 安装重视
      rpm -ivh MySQL-devel-5.5.48-1.el6.x86_64.rpm
    [root@huachao mysql]# rpm -ivh MySQL-devel-5.5.48-1.el6.x86_64.rpm 
    warning: MySQL-devel-5.5.48-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Preparing...                ########################################### [100%]
       1:MySQL-devel            ########################################### [100%]
    
    • 安装mysql-service
      rpm -ivh MySQL-server-5.5.48-1.el6.x86_64.rpm
    [root@huachao mysql]# rpm -ivh MySQL-server-5.5.48-1.el6.x86_64.rpm 
    warning: MySQL-server-5.5.48-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Preparing...                ########################################### [100%]
        file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
        file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.5.48-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-5.el6_6.x86_64
    
    • 卸载争执的包mysql-libs-5.1.73-5.el6_6.x86_64
      rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps
      从未提醒表示卸载成功

    • 再安装mysql-service
      rpm -ivh MySQL-server-5.5.48-1.el6.x86_64.rpm

    [root@huachao mysql]# rpm -ivh MySQL-server-5.5.48-1.el6.x86_64.rpm 
    warning: MySQL-server-5.5.48-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Preparing...                ########################################### [100%]
       1:MySQL-server           ########################################### [100%]
    170808  4:34:10 [Note] /usr/sbin/mysqld (mysqld 5.5.48) starting as process 4144 ...
    170808  4:34:10 [Note] /usr/sbin/mysqld (mysqld 5.5.48) starting as process 4151 ...
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    /usr/bin/mysqladmin -u root password 'new-password'
    /usr/bin/mysqladmin -u root -h huachao.com password 'new-password'
    
    Alternatively you can run:
    /usr/bin/mysql_secure_installation
    
    which will also give you the option of removing the test
    databases and anonymous user created by default.  This is
    strongly recommended for production servers.
    
    See the manual for more instructions.
    
    Please report any problems at http://bugs.mysql.com/
    
    [root@huachao mysql]# 
    

    地方提醒表示安装成功
    小心:留心看安装成功后的唤醒,然后来安装mysql,不然那么些设置的mysql就费了,重新安装的话会更难装

    • 查阅端口
      netstat -ntpl
    [root@huachao mysql]# netstat -ntpl
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
    tcp        0      0 0.0.0.0:40290               0.0.0.0:*                   LISTEN      2248/rpc.statd      
    tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2191/rpcbind        
    tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2487/sshd           
    tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2292/cupsd          
    tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2679/master         
    tcp        0      0 :::46790                    :::*                        LISTEN      2248/rpc.statd      
    tcp        0      0 :::111                      :::*                        LISTEN      2191/rpcbind        
    tcp        0      0 :::22                       :::*                        LISTEN      2487/sshd           
    tcp        0      0 ::1:631                     :::*                        LISTEN      2292/cupsd          
    tcp        0      0 ::1:25                      :::*                        LISTEN      2679/master 
    

    尚未3306的端口,表明mysql的service未有运营,接下去运营mysql的service

    • 启动mysql
      service mysql start
    [root@huachao mysql]# service mysql start
    Starting MySQL..[确定]
    [root@huachao mysql]# 
    

    开行成功后得以再查看贰遍端口,能够观望3306的端口

    • 设置mysql-client才干设置mysql
    [root@huachao mysql]# rpm -ivh MySQL-client-5.5.48-1.el6.x86_64.rpm 
    warning: MySQL-client-5.5.48-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Preparing...                ########################################### [100%]
       1:MySQL-client           ########################################### [100%]
    

    设置成功

    • 设置mysql密码
      /usr/bin/mysql_secure_installation
      按回车键后会有5个需求料定的地点
      • Enter current password for root (enter for none):
        输入当前密码,当前未有密码,直接按回车键
      • Set root password? [Y/n] y
        安装root密码,按y然后按回车
        New password:输入root密码,然后按回车
      • Remove anonymous users? [Y/n] y
        去除无名氏客户,按y然后按回车
      • Disallow root login remotely? [Y/n] n
        差别意远程登陆,按n然后按回车
      • Remove test database and access to it? [Y/n] y
        剔除测量试验数据库,按y然后按回车
      • Reload privilege tables now? [Y/n] y
        双重加载权限表,按y然后按回车

    mysql就按安装和布局成功了

    • 登录mysql
      mysql -uroot -p密码

      新葡亰496net 1

    mysql登录成功
    

    实行那么些命令后就能够来看可安装的mysql

     

    yum repolist enabled | grep "mysql.*-community.*"

    成功安装之后重启mysql服务

    倘使大家是要设置新型的本子,那么能够直接实施

    service mysqld restart
    

    sudo yum install mysql-server

    第一安装mysql是root账户是尚未密码的

    设置到位后,使用 service 命令运维 mysql 服务:

    设置密码的形式

    service mysqld start

    mysql -uroot
    mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
    mysql> exit
    

    追寻mysql安装初叶化密码

      

    grep "password" /var/log/mysqld.log

    2016-03-16T03:52:53.480966Z 1 [Note] A temporary password is generated for root@localhost: 8v&4wk(U5ilT ## 第一行“root@localhost:”后边的字符便是密码了,大家供给用它来安装大家和睦的root登入密码

    下一场我们要求轻便布置一下 mysql ,私下认可安装今后 mysql 的 root

    客户是未有密码的,对于生产条件来讲,那自然是非常的,别的还应该有部分完好无损有关的设置,能够接纳上边那行命令去布置一下,它是贰个向导,问你有些标题,你要

    交由答案,例如是还是不是要设置 root 客商的密码, 密码是怎么着等等。

    mysql_secure_installation

    Enter current password for root (enter for none):

    分解:输入当前 root 客商密码,默感觉空,直接回车。

    Set root password? [Y/n]  y

    释疑:要设置 root 密码吗?输入 y 表示愿意。

    Remove anonymous users? [Y/n]  y

    分解:要移除掉无名氏客商吗?输入 y 表示乐意。

    Disallow root login remotely? [Y/n]  y

    释疑:不想让 root 远程登入吗?输入 y 表示愿意。

    Remove test database and access to it? [Y/n]  y

    分解:要去掉 test 数据库吗?输入 y 表示乐意。

    Reload privilege tables now? [Y/n]  y

    释疑:想要重新加载权限吗?输入 y 表示愿意。

    转变MySQL的数据文件到数据盘

    更改MySQL目录

    上面笔者收拾一下把MySQL从/var/lib/mysql目录上边转移到/home/mysql_data/mysql目录的具体操作:

    1、首先大家要求关闭MySQL,命令如下:

    service mysqld stop

    2、然后是退换数据,为了安全之间,大家利用复制命令cp,先找到mysql的原目录

    cd /var/lib

    ls

    运作这些命令之后就能够见到mysql的目录了,然后实施cp命令

    cp -a mysql /mnt/web/data/ #如此那般就把数据库复制到/mnt/web/data/mysql/上边去了

    留意:(-a那个参数一定要带着,不然复制过去的权柄就狼狈了。)

    即便数据库非常大的话,时间会相比较长,只怕会晚点,具体怎么设置ssh不超时的秘籍,请我们温馨找有关质感。

    3、然后我们修改配置文件,一共有四个,上边作者逐个表达:

    修改第三个公文:修改以前先备份cp /etc/my.cnf /etc/my.cnf.back

    vi /etc/my.cnf

    新葡亰496net:04_软件设置和卸载。张开之后修改datadir的目录为/mnt/web/data/mysql

    把socket改成/mnt/web/data/mysql/mysql.sock #为了安全起见,你能够把原本的批注掉,然后重新参加一行,改成未来的目录。

    ==================================================================================

    修改第叁个文本:修改以前先备份 cp /etc/init.d/mysqld /etc/init.d/mysqld.back

    vi /etc/init.d/mysqld

    注意:精确的职位是/etc/rc.d/init.d/mysqld,由于此处这里有两个/etc/init.d到/etc/rc.d/init.d的炫酷,

    为此用地点的命令就可以,也大约。

    把其中get_mysql_option mysqld datadir "/var/lib/mysql"一行中,等号右侧的路子改成你将来的其实存放路线:/mnt/web/data/mysql

    =================================================================================

    修改第三个文本:修改在此之前先备份 cp /usr/bin/mysqld_safe /usr/bin/mysqld_safebak

    vi /usr/bin/mysqld_safe

    此地也是修改 DATADI酷威=/var/lib/mysql的目录为/mnt/web/data/mysql

    ==================================================================================

    新葡亰496net,4、上边须要树立三个mysql.sock的链接:

    ln -s /mnt/web/data/mysql/mysql.sock /var/lib/mysql/mysql.sock

    至此全体的修改都完毕了,下边运行mysql

    service mysqld start

    依旧重启linux

    reboot

    一经能平常运转,表达修改成功。

    本文由新葡亰496net发布于网络数据库,转载请注明出处:新葡亰496net:04_软件设置和卸载

    关键词:

上一篇:没有了

下一篇:没有了