首页 技术 正文
技术 2022年11月16日
0 收藏 675 点赞 3,648 浏览 3007 个字
  1. 下载 mysql 安装包

    $ wget https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
    # or
    $ curl -O https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
  2. 解压

    $ tar -zxvf mysql-5.6.44.tar.gz
    $ cd mysql-5.6.44
  3. 配置 mysql 用户

    $ groupadd mysql
    $ useradd -g mysql -s /sbin/nologin -M mysql
  4. 安装前置扩展

    $ yum -y install gcc gcc-c++ make cmake ncurses-devel bison libaio autoconf
  5. 编译和安装 「参数详情:点我查看

    $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci  -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1
    $ make && make install
    # 没有太大的原因这里应该会成功的
  6. 配置和运行

    • 配置 mysql 启动文件

      $ cd /usr/local/mysql
      $ cp support-files/mysql.server /etc/init.d/mysqld
      $ cp support-files/my-default.cnf /etc/my.cnf
      $ cd scripts
      $ ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/
    • 配置系统变量

      $ echo "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile

$ source /etc/profile

“`

  • 修改默认的 /etc/my.cnf

    [mysqld]user = mysql
    port = 3306
    socket = /tmp/mysql.sock
    basedir = /usr/local/mysql
    datadir = /usr/local/mysql/data
    open_files_limit = 10240[mysqld_safe]
    log-error=/usr/local/mysql/data/mysql_oldboy.err
    pid-file=/usr/local/mysql/data/mysqld.pidsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  • 启动

    # 启动 mysql
    $ service mysqld start
  • 设置root密码

    $ mysql_secure_installation
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
    SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the current
    password for the root user. If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.Enter current password for root (enter for none):
    OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MySQL
    root user without the proper authorisation.
    # 设置 root 密码
    Set root password? [Y/n] Y
    New password:
    Re-enter new password:
    Password updated successfully!
    Reloading privilege tables..
    ... Success!By default, a MySQL installation has an anonymous user, allowing anyone
    to log into MySQL without having to have a user account created for
    them. This is intended only for testing, and to make the installation
    go a bit smoother. You should remove them before moving into a
    production environment.
    # 删除 匿名用户
    Remove anonymous users? [Y/n] Y
    ... Success!Normally, root should only be allowed to connect from 'localhost'. This
    ensures that someone cannot guess at the root password from the network.
    # 设置 root 只能来自本机登录
    Disallow root login remotely? [Y/n] Y
    ... Success!By default, MySQL comes with a database named 'test' that anyone can
    access. This is also intended only for testing, and should be removed
    before moving into a production environment.
    # 删除测试数据库
    Remove test database and access to it? [Y/n] Y
    - Dropping test database...
    ... Success!
    - Removing privileges on test database...
    ... Success!Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    # 重新加载配置
    Reload privilege tables now? [Y/n] Y
    ... Success!All done! If you've completed all of the above steps, your MySQL
    installation should now be secure.Thanks for using MySQL!Cleaning up...
  • 设置开机自启动

    $ /sbin/chkconfig mysqld on

完成所有的安装和启动,重启一下试试 mysql 是否能正常自动启动。如果可以 mysql 就安装完成了

上一篇: 非旋(fhq)Treap小记
下一篇: Dubbo架构
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,078
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,553
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,402
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,177
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,814
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898