recentpopularlog in

racl101 : database   436

« earlier  
Backup (mysql dump) all your MySQL databases in separate files - Running with Ruby
Really good, simple to understand Bash shell script demonstrating how to backup all the databases in a given mysql server installation into a single file or into separate files (one for each database).
blog  tutorial  howto  example  guide  reference  backup  export  database  dump  sql  files  shell  script  single  separate  mysql  bash 
5 weeks ago by racl101
Script to open a mysql database in Sequel Pro from a service in docker-compose.
A gist of an Bash Shell Script to open up Sequel Pro MacOS / MacOS X app with credentials to view a MySQL database running within a Docker container.
github  gist  script  bash  shell  open  sequel  pro  sequelpro  database  mysql  docker  container  credentials  totry  guide  reference 
9 weeks ago by racl101
Connecting to a mysql running on a Docker container · Issue #95 · docker-library/mysql
Frankly, this forum page has no consensus on a solution to this issue. Nevertheless, what worked for me on my set up with running MacOS as the Docker host and running a container with: Ubuntu 16.04 and MySQL 5.7 is the following:

1) Within the container: change in /etc/mysql/mysql.conf.d/mysqld.cnf the bind-address option from 127.0.0.1 to 0.0.0.0
2) Restart MySQL server (note that whenever you start MySQL you must use this command in the Dockerfile:

RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
RUN find /var/lib/mysql -type f -exec touch {} \; && service mysql start

That is, you must touch the files in /var/lib/mysql and then start the server with service command and not systemctl.

Next, create a user separate from root e.g. dev_1, in MySQL and given them privileges to their '0.0.0.0' and '%' hosts. Like this in the Dockerfile:

RUN find /var/lib/mysql -type f -exec touch {} \; && service mysql start && mysql -uroot -proot mysql -e "GRANT ALL ON *.* TO root@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION; CREATE USER 'dev_1'@'0.0.0.0' IDENTIFIED BY 'secret'; GRANT ALL ON *.* TO 'dev_1'@'0.0.0.0' IDENTIFIED BY 'secret' WITH GRANT OPTION; GRANT ALL ON *.* TO 'dev_1'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION; FLUSH PRIVILEGES;"

Then when you start the container you must publish the port number like so:

docker run -t -d -p 4406:3306 ubuntu_16_04_lemp_php_7_2:latest

If your container stops prematurely, then you might want to add a CMD line in your docker file to run a start.sh script and within that script you might want to add something like this:

# stupid hack to keep container from being stopped
tail -f /dev/null

Finally, to connect to your DB instance on your local MacOS machine with an app like Sequel Pro for example, use the following credentials:

Host: 0.0.0.0
Username: dev_1
Password: <dev_1_password>
Port: 4406

If you don't like to use port 4406, try 3307, 3308, 3309.
github  forum  howto  example  troubleshoot  mysql  server  docker  host  connection  issue  sequel  pro  mariadb  client  hostname  docker-machine  ip  address  ipaddress  guide  reference  toread  tolearn  totry  tounderstand  image  port  detached  database  credentials 
9 weeks ago by racl101
SQLAlchemy Documentation — SQLAlchemy 1.2 Documentation
Seems that the key to learning to work with databases in Python requires understanding SQL Alchemy.
documentation  guide  reference  sqlalchemy  python  database  toolkit  driver  orm  relational  engine  mysql  sqlite3  tutorial  howto  example  resource 
september 2018 by racl101
php - belongsToMany relationship in Laravel across multiple databases - Stack Overflow
Someone figured out how to do a relationship column / property between two models (with pivot table), i.e. belongsToMany where the second model might have a dynamic database connection (i.e. it's not the same each time a query is done). So they figured out howto obtain the database for the current database connection (i.e. the current PHP script execution).
stackoverflow  laravel  laravel5  howto  belongstomany  model  relationship  property  column  between  different  database  connections  example  guide  reference  pivot  table 
may 2018 by racl101
Update Amazon RDS max_connections with Parameter Group · Issue #16 · jollygoodcode/jollygoodcode.github.io
This thread discussion might provide some insight into manually increasing the mysql max_connections option / setting manually and overriding Amazon's AWS "sensible" defaults.
github  forum  aws  amazon  howto  override  change  mysql  database  db  option  variable  max_connections  setting  totry  example  guide  reference 
april 2018 by racl101
Welcome to PyMySQL’s documentation! — PyMySQL 0.7.2 documentation
The documentation is kind of sparse, but it has some good reference links. That's where the meat is.
python  library  pymysql  module  database  mysql  query  api  guide  reference  documentation 
march 2018 by racl101
PEP 249 -- Python Database API Specification v2.0 | Python.org
This tutorial explains the API of the results returned by queries made with the PyMySQL module as well as explaining what cursor objects are. Need to really read and learn this if I hope to be able to write data processing scripts that query MySQL databases in Python.
python  database  api  documentation  guide  reference  tutorial  cursor  pymysql  connection  objects 
march 2018 by racl101
ulimit - Ubuntu 16.04 Server MySql open_file_limit won't go higher than 65536 - Server Fault
Really good example to follow in case increasing max_connections and increasing limits in /etc/security/limits.conf doesn't work.
serverfault  stackexchange  howto  create  mysql  service  override  configuration  file  increase  maximum  open  limit  database  server  example  guide  reference  ubuntu  ubuntu16.04  linux 
november 2017 by racl101
MySQL count all NULL columns - Stack Overflow
Shows how to count rows with columns containing null values and their counts.
mysql  howto  example  stackoverflow  guide  reference  count  column  null  value  query  database 
september 2017 by racl101
« earlier      
per page:    204080120160

Copy this bookmark:





to read