mysql基础知识----安装

下载安装包

  1.打开http://dev.mysql.com/downloads/mysql/ 官网,选择需要的版本进行下载


2.可以使用Linux命令安装,命令如下:
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

安装步骤:

  1. 解压并移动文件到/usr/local/mysql
  [root@qixc-test mysql]# tar -vxzf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz 
  [root@qixc-test mysql]# mv mysql-5.6.33-linux-glibc2.5-x86_64 mysql
  [root@qixc-test mysql]# mv mysql /usr/local/
   2.在安装路径下执行安装命令:
  [mysql@qixc-test mysql]$ ./scripts/mysql_install_db --user=mysql --				datadir=/usr/local/mysql/data/mysql/
  问题一:FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
  Data::Dumper
 解决:root安装yum -y install autoconf	
 问题二:Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: l	ibaio.so.1: cannot open shared object file: No such file or directory
  解决:yum install libaio* -y
  3.添加启动服务:
 [root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
  4.调整my.cnf配置文件内容,配置安装路径,如图,
  [mysqld]
  datadir=/usr/local/mysql/data/mysql
  socket=/var/lib/mysql/mysql.sock
  5.配置软连接:
  建立软连接:
  ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql      
  问题:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)      
  解决:建立软连接
  ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
  6.登录 mysql -uroot -p 
  7.修改密码:update user set password=password("123456") where user='root';
      flush privileges;
  8.再次登录:mysql -uroot -p123456
  9.远程登录报错:	
 前提:端口正常访问
  1.修改数据库:update user set host = '%' where user = 'root';
  2.授权法GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
  3. 刷新    flush privileges;
posted @ 2020-05-21 20:18  测试爬虫  阅读(108)  评论(0编辑  收藏  举报