User Tools

Site Tools


Sidebar



mysql

MySQL

ERROR 1045 (28000): Access denied for user...

mysql -u root -p

export table to CSV file

SELECT * FROM uren INTO OUTFILE '~/Documents/backup/rick.csv' FIELDS ENCLOSED BY '"' TERMINATED BY ';' ESCAPED BY '"' LINES TERMINATED BY '\r\n';

make backup of SQL database

mysqldump -uroot db_name > backup.sql

or

mysqldump -u YourUser -pUserPassword YourDatabaseName > wantedsqlfile.sql

Import SQL file

mysql -u DB_USER -p -h localhost DB_NAME < /tmp/dump.sql

MySQL data files on CentOS

/var/lib/mysql/

Location of MySQL files on Mac OSX installed with Homebrew

/usr/local/var/mysql
/usr/local/Cellar/mysql/5.7.12

MariaDB

installed with brew install mariadb

To connect:

  mysql -uroot

To have launchd start mariadb at login:

  ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents

Then to load mariadb now:

  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist

Or, if you don't want/need launchctl, you can just run:

  mysql.server start
  

copy mysql database from one server to another

see linux

mysql client for osx

format date from timestamp in mysql

SELECT DATE_FORMAT(FROM_UNIXTIME(beginDate),"%e-%m-%Y %H:%i")

more info

change mysql password

mysqladmin -u root password root

connect to mysql database

mysql -u rick -pXXXXXX
mysql -u globe4d_user -pXXXX

create database

create database databasename;

show grants

show grants;

ERROR 1044 (42000): Access denied for user

het zou kunnen dat je op de server met mysql probeert te verbinden met je 'gewone' user en dat die geen toegang heeft. Vaak wordt er voor je database een aparte user gebruikt bijvoorbeeld 'globe4d_user' met z'n eigen wachtwoord.

show databases

use database

use db_name;

show tables

show columns

show columns from uren;

problem

  • ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  • try to start the mysql server:
mysql.server start
  • ERROR! The server quit without updating PID file (/usr/local/var/mysql/rick.local.pid).''

install mysql using macports

problem: No such file or directory

  • als php niet kan connecten met database controleer dan of php mysql uberhaupt kan vinden.

PHP Warning: mysqli::mysqli(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /........

Hmm, dit misschien
Misschien een conflict met de PHP van OSX zelf?

mysql.txt · Last modified: 2016/07/05 20:49 by rick