unit uDBDM;

interface

uses
  System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
  FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.Async,
  FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Phys,
  FireDAC.VCLUI.Wait, FireDAC.Phys.MySQLDef, FireDAC.Phys.MySQL, Data.DB, FireDAC.Comp.Client,
  FireDAC.Comp.DataSet;

type
  TDataModule1 = class(TDataModule)
    qSelect: TFDQuery;
    qInsert: TFDQuery;
    qEdit: TFDQuery;
    qDelete: TFDQuery;
    qGetKey: TFDQuery;
    FDConnection: TFDConnection;
    FDPhysMySQLDriverLink: TFDPhysMySQLDriverLink;
    procedure Connect(Sender:TObject);
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  DataModule1: TDataModule1;

implementation

{%CLASSGROUP 'Vcl.Controls.TControl'}

{$R *.dfm}

procedure TDataModule1.Connect(Sender: TObject);
var oParams:Tstrings;
begin
     oParams := TStringList.Create;
//  oParams.Add('DriverID='+DriverID);
  oParams.Add('DataBase=test_db');
  oParams.Add('Password=testpassword');
  oParams.Add('User_Name=testuser');
  oParams.Add('Port=3306');
  oParams.Add('Server=localhost');

   FDConnection.Params.Assign(oParams);
   FDConnection.DriverName:='MySQL';

   oParams.Free;
end;

procedure TDataModule1.DataModuleCreate(Sender: TObject);
begin
//Подключение
Self.Connect(Self);

end;

end.
