User Tools

Site Tools


Sidebar

software:mariadb:setup

What?

Simple setup and population of mysql/mariadb.

# yum -y install mysql-server.x86_64
yum groupinstall mariadb mariadb-client -y

# service mysqld start
systemctl start mariadb
systemctl enable mariadb

# if network access is not required
vi /etc/my.cnf
# in [mysqld] add skip-networking=1

# now strip down the installation:
mysql_secure_installation

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h $(hostname) password 'new-password'
mysql --user root --password=new-password

(root@localhost) [(none)]>create database mydb;
use mydb
Database changed
CREATE TABLE example_autoincrement (id INT NOT NULL
  AUTO_INCREMENT PRIMARY KEY, data VARCHAR(100) );
INSERT INTO example_autoincrement (data) VALUES ('Hello world');
SELECT * FROM  example_autoincrement;

populating

echo "0,'idufdhfkjdhdfkjfdhfdkjhfdkjhkjfddfd'" >data
for i in {0..1000}; do cat data >>data_big; done
for i in {0..100}; do cat data_big >>data_big2; done

mysql  --user root --password=new-password mydb
LOAD DATA LOCAL INFILE '/root/data_big2' INTO TABLE example_autoincrement FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

while :; do echo "LOAD DATA LOCAL INFILE '/root/data_big2' INTO TABLE example_autoincrement FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';" | mysql  --user root --password=new-password mydb; echo -n '.'; done
software/mariadb/setup.txt ยท Last modified: 2021/03/23 12:22 (external edit)