When setting up a server or group of servers for the first time you may find yourself wanting to create MySQL users without having to login to MySQL. It would make sense for the mysqladmin command to offer this functionality but it does not. Instead you can create the MySQL user with the mysql command as shown in the below example performed on a server running Ubuntu Linux 12.04 also known as Precise Pangolin.
I recently launched my first word press web site and had a friend tell me that a important security precaution was to change the table prefix of your word press database. The default prefix for the tables is “wp_” which can make it extremely easy for a attacker to run sql injection commands through flaws the they may find in word press. If we can change the name of a table a attacker will have to figure out that information as well thereby adding one more layer of security to our site. I was getting ready to change all the wp_ prefix’s manually when I discovered a plug in called WP Security Scan which claimed to automate the process.
To modify a user’s password in PostgreSQL via the psql CLI use the below syntax.
- [postgres@server pgsql]# psql -U postgres
- postgres=# ALTER USER user WITH PASSWORD 'password';
Change user to the proper username and password to the new password you want to set. You will see a “ALTER ROLE” confirmation after issuing the command.