mysql

A collection of 13 posts

Change/update MySQL password

change mysql password update

To change the MySQL password for a particular user first login to MySQL: mysql -u root -p Next update the appropriate user's password with the following command: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('NEW_PASSWORD');

Replace text in MySQL query

mysql replace text query

If you'd like to replace the text in a MySQL column you can run the following query: UPDATE tableName SET columnName = REPLACE(columnName, 'old text to replace', 'new text to replace with') WHERE columnName LIKE '%search_term%'; LIKE '%search_term%'

Export MySQL results to outfile/CSV

mysql outfile csv export

To export MySQL results to an outfile or CSV file: SELECT column_name FROM table_name INTO OUTFILE '/var/lib/mysql-files/export.csv'; If you receive the following error: The MySQL server is running with the --secure-file-priv option so it cannot execute this