sunren 发表于 2018-10-11 09:50:36

Mysql单实例的安装配置指南

  实验环境:
  操作系统:CentOS 6.8
  虚拟机:VMware
  数据库:mysql-5.1.62.tar.gz
  安装步骤:
  #wgethttp://soft.vpser.net/datebase/mysql/mysql-5.1.62.tar.gz
  #tarzxf mysql-5.1.62.tar.gz
  #./configure\
  --prefix=/usr/local/mysql \
  --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
  --localstatedir=/usr/local/mysql/data \
  --enable-assembler \
  --enable-thread-safe-client \
  --with-mysqld-user=mysql \
  --with-big-tables \
  --without-debug \
  --with-pthread \
  --enable-assembler \
  --with-extra-charsets=complex \
  --with-readline \
  --with-ssl \
  --with-embedded-server \
  --enable-local-infile \
  --with-plugins=partition,innobase \
  --with-mysqld-ldflags=-all-static \
  --with-client-ldflags=-all-static
  /bin/rm: cannot remove `libtoolT': No such file or directory
  config.status: executing default commands
  Thank you for choosing MySQL!
  Remember to check the platform specific part of the reference manual
  for hints about installing MySQL on your platform.
  Also have a look at the files in the Docs directory.
  ##make
  ##make install
  # ls -l support-files/*.cnf
  # /bin/cp support-files/my-small.cnf /etc/my.cnf
  # cat /etc/my.cnf
  # mkdir -p /usr/local/mysql/data
  # chown -R mysql /usr/local/mysql
  # /usr/local/mysql/bin/mysql_install_db --user=mysql
  # chmod -R 777 /tmp/
  #启动mysql数据库
  # cp support-files/mysql.server /usr/local/mysql/bin
  # chmod 700 /usr/local/mysql/bin/mysql.server
  # /usr/local/mysql/bin/mysql.server start   #启动数据库的方法之一
  Starting MySQL. SUCCESS!
  # netstat -lnt|grep 3306
  # /usr/local/mysql/bin/mysql.server stop
  Shutting down MySQL... SUCCESS!
  #配置全局路径
  # echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile
  #source /etc/profile
  #配置/etc/init.d/mysqld start方式启动数据库方法之二
  # cp support-files/mysql.server /etc/init.d/mysqld
  # chmod 700 /etc/init.d/mysqld
  # /etc/init.d/mysqld restart
  Shutting down MySQL... SUCCESS!
  Starting MySQL. SUCCESS!
  # /etc/init.d/mysqld restart
  Shutting down MySQL..... SUCCESS!
  Starting MySQL. SUCCESS!
  # chkconfig--list mysqld
  mysqld 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig --add mysqld”)
  # chkconfig --add mysqld
  # chkconfig --list mysqld
  mysqld         0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭
  # chkconfig mysqld off#也可以关闭该服务
  可以使用如下三种命令登录:
  mysql -uroot -p,mysql -uroot,mysql -uroot -p '密码'
  mysql安装完成后,默认情况下,管理员帐号root是无密码的。
  为root增加密码:
  # mysqladmin -u root password'skyboy'
  # mysql
  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
  mysql> select user,host from mysql.user;
  +------+-----------------+
  | user | host            |
  +------+-----------------+
  | root | 127.0.0.1       |
  |      | localhost       |
  | root | localhost       |
  |      | www.sky9890.com |
  | root | www.sky9890.com |
  +------+-----------------+
  #下面删除多余账号:
  mysql> drop user ''@localhost;
  Query OK, 0 rows affected (0.00 sec)
  mysql> drop user ''@www.sky9890.com;
  mysql> drop user 'root'@www.sky9890.com;
  Query OK, 0 rows affected (0.00 sec)

页: [1]
查看完整版本: Mysql单实例的安装配置指南