Linux MySQL Installation Tutorial

Ubuntu, OpenWRT, Debian,OpenKyline has a package manager that allows for direct online software installation. However, embedded operating systems, such as Buildroot, typically use cross-compilation to install software like the MySQL database.Most commonly used software actually has pre-compiled installation packages available, so customers do not need to recompile. Here, we take the MySQL database as an example; the package includes an install.sh script that can be executed to directly install it onto the system.We provide two versions of MySQL: MySQL 5 and MySQL 8. Here, we will install MySQL 5.Linux MySQL Installation TutorialUpload the installation package to the device and extract the installation package:

# lsinstall.sh            mysql-5.7.27-aarch64libncurses.so.6       mysqld# ./install.shaddgroup: group 'mysql' in useadduser: /home/mysql: No such file or directory#

This completes the installation; all these installation packages have been verified.Now, let’s start mysqld.

# /etc/init.d/S99mysqld startStarting MySQL..... SUCCESS!#

Startup successful, let’s check the process:

  210 root     /sbin/udevd -d  229 root     [kbase_job_fault]  230 root     [kworker/u9:1-xp]  232 root     [kworker/0:2H-kb]  250 root     dbus-daemon --system  254 root     /usr/sbin/rpcbind  268 root     dhcpcd: [manager] [ip4] [ip6]  292 root     /usr/sbin/ntpd -g -p /var/run/ntpd.pid  365 root     sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups  396 root     -bash  424 root     [kworker/1:2H]  500 root     {mysqld_safe} /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir 2081 mysql    /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir 2095 root     [kworker/0:0H] 2108 root     /bin/login 2109 root     ps#

Use the MySQL command to check (default root user, empty password):

# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.27-log Source distributionCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

Change the root user password:

mysql -u root -p   # Execute in the bin directory===========================================================    After logging in successfully, execute the following operations:    SET PASSWORD = PASSWORD('123456');        // Set a new password    ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;        FLUSH PRIVILEGES;   

Configure MySQL for remote access:

use mysql       # Access the mysql database    update user set host = '%' where user = 'root';      # Allow root to access from any host    FLUSH PRIVILEGES;                                    # Refresh

Restart the system and check if MySQL starts automatically:

Saving random seed: OKStarting system message bus: doneStarting rpcbind: OKStarting iptables: OKStarting network: OKStarting dhcpcd...no such user dhcpcddhcpcd-9.4.1 startingdev: loaded udevDUID 00:01:00:01:30:3e:b1:80:aa:ca:59:c8:3d:4bno interfaces have a carrierforked to background, child pid 270Starting ntpd: OKStarting sshd: OK/dev/by-name/userdata already formatStarting Wifi: OKStarting MySQL...... SUCCESS!Welcome to Huiwei HW507-CORE PlatformLongan login:

<span><span>We can see that MySQL has started automatically on boot.</span></span>If you need to modify the configuration, we can check the my.cnf file:

[client]port = 3306socket = /dev/shm/mysql.sock[mysqld]port = 3306socket = /dev/shm/mysql.sockbasedir = /usr/local/mysqldatadir = /usr/local/mysql/datapid-file = /usr/local/mysql/data/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 1init-connect = 'SET NAMES utf8mb4'character-set-server = utf8mb4#skip-name-resolve#skip-networkingback_log = 300max_connections = 1000max_connect_errors = 6000open_files_limit = 65535table_open_cache = 128max_allowed_packet = 4Mbinlog_cache_size = 1Mmax_heap_table_size = 8Mtmp_table_size = 16Mread_buffer_size = 2Mread_rnd_buffer_size = 8Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 4Mthread_cache_size = 8query_cache_type = 1query_cache_size = 8Mquery_cache_limit = 2Mft_min_word_len = 4log_bin = mysql-binbinlog_format = mixedexpire_logs_days = 30log_error = /usr/local/mysql/logs/mysql-error.logslow_query_log = 1long_query_time = 1slow_query_log_file = /usr/local/mysql/logs/mysql-slow.logperformance_schema = 0explicit_defaults_for_timestamp#lower_case_table_names = 1skip-external-lockingdefault_storage_engine = InnoDB#default-storage-engine = MyISAMinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 64Minnodb_write_io_threads = 4innodb_read_io_threads = 4innodb_thread_concurrency = 0innodb_purge_threads = 1innodb_flush_log_at_trx_commit = 2innodb_log_buffer_size = 2Minnodb_log_file_size = 32Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 120bulk_insert_buffer_size = 8Mmyisam_sort_buffer_size = 8Mmyisam_max_sort_file_size = 10Gmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800[mysqldump]quickmax_allowed_packet = 16M[myisamchk]key_buffer_size = 8Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4M

Other software installation methods are similar: upload the software package, extract it, enter the directory, and execute the ./install.sh script.Introduction to the specifications of the G8701 Smart Hardware AI-BOXLinux MySQL Installation Tutorial

Leave a Comment