美文网首页
MySQL迁移mariaDB

MySQL迁移mariaDB

作者: 小熊哈哈 | 来源:发表于2020-04-08 22:47 被阅读0次

    1.初始化

    进入bin目录下执行

    mysql_install_db
    

    2.修改配置文件

    进入data目录下,修改my.ini

    [mysqld]
    basedir=D:\Application\mariadb-10.4.12-winx64
    datadir=D:\Application\mariadb-10.4.12-winx64\data
    port=3307
    sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    default_storage_engine=innodb
    max_connections=100
    query_cache_size=0
    innodb_strict_mode = 0
    innodb_file_per_table=1
    innodb_buffer_pool_size=2047M
    innodb_log_file_size=50M
    max_allowed_packet = 500M
    character-set-server=utf8
    log-bin=D:\Application\mariadb-10.4.12-winx64\log\mysql-bin
    log_bin_index=D:\Application\mariadb-10.4.12-winx64\log\mysql-bin.index
    log_bin_trust_function_creators=1
    binlog_format=mixed
    expire_logs_days=7
    max_binlog_size=100m
    binlog_cache_size=4m
    max_binlog_cache_size=512m
    [client]
    port=3307
    plugin-dir=D:/Application/mariadb-10.4.12-winx64/lib/plugin
    

    3.注册服务

    mysqld --install mariaDB
    

    4.启动服务

    net start mariaDB
    

    5.修改密码

    mysql -uroot -p
    use mysql
    ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("123456");
    grant all privileges on * to root@'%' identified VIA mysql_native_password USING PASSWORD("123456");
    flush privileges;
    

    7.yml文件配置替换

    添加dependency依赖

    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>1.1.7</version>
    </dependency>
    

    mysql配置

     driverClassName: com.mysql.jdbc.Driver
     url: jdbc:mysql://${datasource.url}/gepadmin?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
    

    mariadb配置

     driverClassName: org.mariadb.jdbc.Driver
     url: jdbc:mariadb://${datasource.url}/gepadmin?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
    

    相关文章

      网友评论

          本文标题:MySQL迁移mariaDB

          本文链接:https://www.haomeiwen.com/subject/tblfmhtx.html