zoukankan      html  css  js  c++  java
  • MySQL在linux上的二进制安装方法

    建组、建用户:

    [root@dbking mysql]# groupadd mysql

    [root@dbking mysql]# useradd -g mysql mysql

    解压安装程序:

    [root@dbking mysql]# tar -zxvf mysql.tar.gz

    [root@dbking mysql]# mv /rpm/mysql /usr/local/mysql

    初始化:

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

    配置文件:

    [root@dbking mysql]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

    basedir = /usr/local/mysql

    datadir = /usr/local/mysql/data

    port = 3306

    log_error=mysql.err

    修改目录权限:

    [root@dbking mysql]# chown -R mysql:mysql /usr/local/mysql/

    修改环境变量:

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

    启动数据库:

    [mysql@dbking ~]$ /usr/local/mysql/bin/mysqld --user=mysql &

    或者

    [mysql@dbking ~]$ /usr/local/mysql/bin/mysqld_safe --user=mysql &

    设置mysql开机自动启动:

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

    [root@dbking mysql]# chown -R root:root /etc/rc.d/init.d/mysqld

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

    [root@dbking mysql]# chkconfig --add mysqld

    [root@dbking mysql]# chkconfig --list mysqld

    mysqld          0:off 1:off 2:on 3:on 4:on 5:on 6:off

    [root@dbking mysql]# service mysqld status

    ERROR! MySQL is not running

    mysql的root用户授权:

    mysql> grant all privileges on *.* to 'root'@'%' identified by 'oracle';

    Query OK, 0 rows affected (0.00 sec)

    mysql> flush privileges;

    Query OK, 0 rows affected (0.00 sec)

    mysql> set password for 'root'@'%'=password('oracle');

    Query OK, 0 rows affected (0.00 sec)

  • 相关阅读:
    kill all process on a specific port on linux 码农
    rxjs 学习系列二(环境搭建) 码农
    实拍图与摄相头自动合成软件(效果) 码农
    js中for in的用法
    Android sdk资源包res里面的drawable(ldpi、mdpi、hdpi、xhdpi、xxhdpi)
    js中addEventListener中第3个参数
    【agc006f】Blackout
    Trie&可持久化Trie
    【agc014d】Black and White Tree
    【agc009b】Tournament
  • 原文地址:https://www.cnblogs.com/wcwen1990/p/6655271.html
Copyright © 2011-2022 走看看