zoukankan      html  css  js  c++  java
  • centos 6.5 msyql5.6安装

    MySQL 安装

    安装mysql前需要查询系统中含有的有关mysql的软件。

    rpm -qa | grep -i mysql
     
    如下 代表有mysql ,则先进行卸载
    mysql-libs-5.1.73-3.el6_5.x86_64 

    卸载命令  rpm -e --nodeps mysql-libs

    下载mysql地址:http://dev.mysql.com/downloads/mysql/

    tar  xvf MySQL-5.6.35-1.el6.x86_64.rpm-bundle.tar

    yum install perl
    rpm -ivh MySQL-server-5.6.35-1.el6.x86_64.rpm 
    rpm -ivh MySQL-client-5.6.35-1.el6.x86_64.rpm
    在安装启动mysql 服务
    service  mysql start
    查看自动生成的root用户 mysql 密码
    cat /root/.mysql_secret 
    # The random password set for the root user at Fri Dec 23 10:38:10 2016 (local time): OnprW0qIRTiFE5m0
    
    

    运行/usr/bin/mysql_secure_installation,删除anonymous用户。

    # /usr/bin/mysql_secure_installation  --user=mysql

    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.

    You already have a root password set, so you can safely answer 'n'.

    Change the root password? [Y/n]  (是否更换root用户密码 y:是 n 否)

    Change the root password? [Y/n] y

    New password:

    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] (是否删除匿名用户)

    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] (是否禁止root用户远程登录)

    Disallow root login remotely? [Y/n] y

     ... 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] (是否删除test数据库)

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

     - 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] (是否重新加载权限表)

    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...

    [root@iZm5e7kgbuwjnnpwbned77Z ~]# chkconfig
    abrt-ccpp                    0:off            1:off            2:off            3:off            4:off            5:off            6:off
    mysql                        0:off            1:off            2:on             3:on             4:on             5:on             6:off
    netconsole                   0:off            1:off            2:off            3:off            4:off            5:off            6:off
     安装完成后可以用mysql客户端进行远程连接了, root用户无法远程登录,
     需要在centos系统登录msyql 
    mysql -u root –p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 12
    Server version: 5.6.35 MySQL Community Server (GPL)
     
    Copyright (c) 2000, 2016, 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>
     
     
    1.进行授权
    #ip为192.168.29.1可以用root访问
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.29.1' IDENTIFIED BY 'root' WITH GRANT OPTION;
     
    #ip为172.5.0.97可以用root访问
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.5.0.97' IDENTIFIED BY 'root' WITH GRANT OPTION;
     
    #任何主机都可以用root远程访问
    GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";   
     
    #刷新权限
    flush privileges; 

    2.修改表

    update user set host = '%' where user = 'root';
    flush privileges; 
  • 相关阅读:
    jmeter主要函数助手功用说明
    性能测试的分类
    monkey基础
    读《复盘-对过去的事情做思维演练—陈中(著)》感知
    关于postman各功能的说明及用法以及批量执行
    python接口测试-认识POST请求
    关于python3.6上传文件时报错:HTTPSConnectionPool(host='***.org', port=443): Max retries exceeded with url: /post (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAIL解决办法
    [Tips] Mobaxterm添加本地python使用
    [Tips] docker run时运行shell命令
    [Tips] shell 输入输出重定向
  • 原文地址:https://www.cnblogs.com/hjwbla/p/6214073.html
Copyright © 2011-2022 走看看