我用 Linux

Linux安装(MySQL、Maven)和yum源的修改方法

2019-03-15  本文已影响4人  周重hhh

安装MySQL

unzip MySQL-server-5.6.41.zip
MySQL-devel-5.6.41-1.el6.x86_64.rpm
MySQL-server-5.6.41-1.el6.x86_64.rpm
MySQL-client-5.6.41-1.el6.x86_64.rpm
rpm -qa | grep -i mysql   #(查看是否安装了mysql)
yum -y remove mysql-libs*   #(卸载mysql)
rpm -ivh MySQL-devel-5.6.41-1.el6.x86_64.rpm #再安装server、client包
vim /etc/my.cn # 修改配置文件
lower_case_table_names=1 # 大小写不区分
character-set-server=utf8 # 编码格式默认为utf-8
collation-server=utf8_general_ci # 默认编码格式
  /usr/bin/mysql_install_db
  service mysql start
  cat /root/.mysql_secret    #(查看原始密码)
  mysql -uroot –p原始密码     #(登陆mysql)
  set PASSWORD=PASSWORD('123456');
  exit
  mysql -uroot -p123456
  use mysql;
  update user set password=password('123456') where user='root';
  update user set host='%' where user='root' and host='localhost';
  flush privileges;
  exit
chkconfig mysql on

yum源的修改方法

  1. 首先备份CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  1. 下载对应版本的CentOS-Base.repo,放入/etc/yum.repos.d/
   # CentOS 5
   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
   # CentOS 6
   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
   # CentOS 7
   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  1. 运行yum makecache生成缓存
yum makecache

安装Maven

wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
tar -zxvf apache-maven-3.6.0-bin.tar.gz
# 重命名
mv apache-maven-3.6.0 maven
vim /etc/profile
export M2_HOME=/usr/local/maven
export PATH=$M2_HOME/bin:$PATH
source /etc/profile
上一篇下一篇

猜你喜欢

热点阅读