zoukankan      html  css  js  c++  java
  • linux 建立 MySQL 账号

    以 root 身份登录 Linux 系统,创建 mysql 组和用户 [root@Nagios-Server ~]# groupadd mysql

    [root@Nagios-Server ~]# useradd mysql -g mysql -M -s /sbin/nologin [root@Nagios-Server ~]# tail -1   /etc/passwd mysql:x:501:501::/home/mysql:/sbin/nologin

    目前使用 mysql 版本比例:

    Mysql 5.1 –20%   Mysql 5.5 –60%   Mysql 5.6 –20%

    #安装 mysql 错误信息:

    checking for termcap functions library... configure: error: No curses/termcap library found

    #解决方法 yum -y install ncurses-devel

    #安装错误信息

    make[2]: *** [my_new.o] Error 127

    make[2]: Leaving directory `/usr/local/src/mysql-5.0.41/mysys' make[1]: *** [all-recursive] Error 1

    make[1]: Leaving directory `/usr/local/src/mysql-5.0.41' make: *** [all] Error 2

    #创建软连接 ln

    [root@Nagios-Servermysql-5.1.72]# ln -s /application/mysql5.1.72/ /application/mysql

    [root@Nagios-Servermysql-5.1.72]# ll /application/mysql

    lrwxrwxrwx 1 root root 25 12 月   7 21:04 /application/mysql -> /application/mysql5.1.72/

    #注意:若 mysql 和 apache 不是安装在同一天服务上的话。Mysql 的安装就到此为止! 若是在同台服务器上,请继续执行以下操作:

    [root@Nagios-Server tools]# ll mysql-5.1.72/support-files/my*.cnf

    -rw-r--r-- 1 root root   4746 12 月 7 21:03 mysql-5.1.72/support-files/my-huge.cnf

    -rw-r--r--        1         root         root         19779         12        月                           7        21:03 mysql-5.1.72/support-files/my-innodb-heavy-4G.cnf

    -rw-r--r-- 1 root root   4720 12 月 7 21:03 mysql-5.1.72/support-files/my-large.cnf

    -rw-r--r-- 1 root root   4731 12 月 7 21:03 mysql-5.1.72/support-files/my-medium.cnf

    -rw-r--r-- 1 root root   2499 12 月 7 21:03 mysql-5.1.72/support-files/my-small.cnf

    #my.cnf 是 MySQL 默认的配置文件名

    [root@Nagios-Server tools]# cd mysql-5.1.72/support-files/ [root@Nagios-Server support-files]# cp my-small.cnf /etc/my.cnf cp:是否覆盖"/etc/my.cnf"?y

    #创建数据库文件

    [root@Nagios-Server support-files]# mkdir /application/mysql/data –p

    [root@Nagios-Server support-files]# chown -R mysql.mysql /application/mysql/data/ [root@Nagios-Serversupport-files]#/application/mysql/bin/mysql_install_db

    #出现两个 OK 证明完成

    141207 21:16:07 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

    OK

    Filling help tables...

    141207 21:16:08 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

    OK

    #生成了两个库

    [root@Nagios-Server support-files]# ll /application/mysql/data/ 总用量 8

    drwx------ 2 mysql root 4096 12 月   7 21:16 mysql    #系统相关

    drwx------ 2 mysql root 4096 12 月   7 21:16 test       #测试

    #mysql 启动

    [root@Nagios-Server support-files]# /application/mysql/bin/mysqld_safe& [root@Nagios-Server support-files]# netstat -lntup|grepmysqld

    #在/etc/profile 中加入启动的详细路径

    [root@Nagios-Server support-files]# vi /etc/profile

    PATH="/application/mysql/bin/:$PATH"

    #生效

    [root@Nagios-Server support-files]# . /etc/profile

    或者

    [root@Nagios-Server support-files]# source /etc/profile

    #登录 MySQL,查看到数据库表

    [root@Nagios-Server support-files]# mysql mysql> show databases;

    +--------------------+

    | Database                   |

    +--------------------+

    | information_schema |

    | mysql                        |

    | test                         |

    +--------------------+

    3 rows in set (0.00 sec)

  • 相关阅读:
    Django: ModelForm中Meta的fields等成员介绍
    python的random函数
    设置mysql隔离级别
    ubantu 下 修改mysql 默认编码
    jdbc 模板 连接
    sql 注入 与解决
    jdbc 简单连接
    动态代理 例子
    自定义的一个数据输入类
    类加载器 读取配置文件
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11328047.html
Copyright © 2011-2022 走看看