mysql
Hiển thị các bài đăng có nhãn mysql. Hiển thị tất cả bài đăng

Shell Script to install MariaDB on Linux

How Install MariaDB Instead of MySQL?

Tạo một file lưu cấu hình tên là params.ini với nội dung như sau:

DB_ROOT_PASSWORD='your-password'
DB_PORT='3307'

Thật ra không cần dùng file 'param.ini' cũng được, nhưng tôi có thói quen đọc/sửa mọi thứ từ file cấu hình cho tiện, không muốn sau này phải sửa trực tiếp từ script. 

  Tiếp theo là script cài đặt các gói cần thiết và Mariadb-Server
vim mariadb_install.sh 

Dán đoạn code sau vào:

How to dynamically choose the database and table based on input with SQLAlchemy?

 Python: How to dynamically choose the database and table based on input with SQLAlchemy?

If you want to dynamically choose the database URL and table based on input, you can use a more flexible approach by creating a factory function to handle this. This will involve dynamically creating the engine and session based on the input, and then dynamically loading the appropriate model.

Here's a step-by-step guide to achieve this:

1. Define a Model Registry

You can maintain a dictionary of model classes for each database. This way, you can dynamically choose the model based on the table name.

HOW TO INSTALL MARIADB FROM ZIP ON WINDOWS

 How Install MariaDB Instead of MySQL?

1/ Download: MariaDB Server

2/ Giải nén vào:  C:\Apps\Portable\mysql

3/ Mở Notepad, dán đoạn script sau vào:

Installing & Configuring MySQL Server

1. Install mysql mysql-server:

# yum install mysql mysql-devel mysql-server -y

2. Start MySQL server daemon (mysqld):

# chkconfig --level 2345 mysqld on;
service mysqld start

SET A PASSWORD FOR THE MySQL root USER
!
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'vnsysadmin.com'

Alternatively you can run:
# /usr/bin/mysql_secure_installation



3. Login as root database admin to MySQL server:


# mysql -u root -p


mysql> create database dbtest1;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON dbtest1.* TO root@localhost
-> ;
Query OK, 0 rows affected (0.01 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dbtest1 |
| mysql |
+--------------------+
3 rows in set (0.01 sec)

mysql> quit;
Bye
[root@db-test ~]#


#Quick notes 2017.02.24