Skip to main content

Posts

Showing posts from April, 2017

How to Reset a MySQL root password

The MySQL root password allows the root user to have full access to the MySQL database. You must have (Linux) root or (Windows) administrator access to the Cloud Server to reset the MySQL root password. (A.) Reset a MySQL root password c ommand line  :- Step (1.) Stop the MySQL service (Ubuntu and Debian) Run the following command: sudo /etc/init.d/mysql stop OR sudo /etc/init.d/mysqld stop Step (2.) Start MySQL without a password Run the following command. The ampersand (&) at the end of the command is required sudo mysqld_safe --skip-grant-tables & Step (3.) Connect to MySQL Run the following command: mysql -uroot Step (4.) Set a new MySQL root password Run the following command: use mysql; update user set password = PASSWORD ("newpassword") where User='root';  flush privileges;  quit Error : - ERROR 1045 (28000): Access denied for user 'root'@'localhost' I also tried to start with mysql_safe (error.lo...

How to Allow Cross Domain Ajax Requests

ENABLE CROSS-DOMAIN   Browser does not allow cross domain AJAX requests due to security issues. Cross-domain requests are allowed only if the server specifies same origin security policy. To enable CORS, You need to specify below HTTP headers in the server. Access-Control-Allow-Origin – Name of the domain allowed for cross domain requests. * indicates all domains are allowed. Access-Control-Allow-Methods – List of HTTP methods can be used during request. Access-Control-Allow-Headers – List of HTTP headers can be used during request. In PHP, you can use the below code to set the headers. header('Access-Control-Allow-Origin: *'); //I have also tried the * wildcard and get the same response header("Access-Control-Allow-Credentials: true"); header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); header('Access-Control-Max-Age: 1000'); header('Access-Control-Allow-Headers: Content-Type, Content-Range, Content-Di...

How To Create a New User In OrientDB

Step (1.) Console - conn the Console starts in interactive mode. In this mode, the Console loads to an orientdb>prompt. From there you can execute commands and SQL statements as you might expect in any other database console. cd /opt/orientdb/bin/ ./console.sh OrientDB console v.X.X.X (build 0) www.orientdb.com Type 'HELP' to display all the commands supported. Installing extensions for GREMLIN language v.X.X.X orientdb> Step (2.) Connect to a remote database: Creates a user in the current database, using the specified password and an optional role. When the role is unspecified, it defaults to writer CONNECT REMOTE:localhost/<database_name> <user> <password> orientdb> CONNECT REMOTE:192.168.1.1/GratefulDeadConcerts admin my_admin_password Connecting to database [remote:192.168.1.1/GratefulDeadConcerts]...OK Step (3.) Create User Creates a user in the current database, using the specified password and an optional role. When the role is unspec...

How To Create a New User and Grant Permissions in MySQL

Step (1.) How to Create a New User :- we did all of the editing in MySQL as the root user, with full access to all of the databases. However, in the cases where more restrictions may be required, there are ways to create users with custom permissions. Let’s start by making a new user within the MySQL shell: CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; this point new user has no permissions to do anything with the databases. In fact, if new user even tries to login (with the password, password), they will not be able to reach the MySQL shell. Therefore, the first thing to do is to provide the user with access to the information they will need. GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables....

How To Install Oracle Java 7

There are many tutorials available to help you install OpenJDK and JBoss. This is one on the latest concerning Oracle Java and Glassfish. Hopefully this will make deploying easier for Java EE developers. You will need a droplet with Ubuntu 12.04.3 x64 that has been created with DigitalOcean. Login as root by ssh. This article assumes no Java installed and at least 1G memory, as Java EE servers are quite demanding. Step 1): Install Oracle Java 7 Start by updating the package index: ## sudo apt-get update In order to get Oracle Installer of Java 7, we need to add a new apt repository. In order to use add-apt-repository, you need to install python-software-properties. Here's how to do it by  ## apt-get:sudo apt-get install python-software-properties Now you can add the new repository and install from Oracle Installer: ## sudo add-apt-repository ppa:webupd8team/java Make source list up-to-date: ## sudo apt-get update Install Java 7 by  ## apt-get:sudo apt-...

How to glasshfish installation on ubuntu 14.04

Glasshfish installation on ubuntu 14.04 S tep 1.)  Download Glassfish-4.1 zip file  ## wget http://download.java.net/glassfish/4.1/release/glassfish-4.1.zip  Step 2.) Unzip glassfish-4.1.zip file  ##  unzip glassfish-4.1.zip Step 3.) Remove Glassfish-4.1.zip file   ##  rm -f glassfish-4.1.zip Step 4.)  Create the following startup script # # description: Startup script for Glassfish Application Server # processname: glassfish GLASSFISH_HOME=/opt/glassfish4/glassfish export GLASSFISH_HOME GLASSFISH_USER=glassfish export GLASSFISH_USER start() { echo -n "Starting Glassfish: " su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin start-domain domain1" sleep 2 echo "done" } stop() { echo -n "Stopping Glassfish: " su $GLASSFISH_USER -c "$GLASSFISH_HOME/bin/asadmin stop-domain domain1" echo "done" } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: glassfish {...

How to call a PHP function in MVC using AJAX

How to use AJAX in an MVC model I actually treated it a a view, since in most cases you will be needing to create a big part of the model of the application anyway it really isn't that big of a deal. One thing you should decide early on is what formate you want to use for the responses. Many times it is ok to just request html as a response but when you are working with big or more complex datasets you usually will want ther response text to be xml or json (which I use most of the time). The reasoning behind this is that xml and json are structured data that can be manipulated after arrival whereas html you will usually just want to append or replace with parts of the already existing web page. Between xml and json I prefer json because of the small data overhead, on all other points both formats are pretty much the same except if you want to send object methods in your response in which case json is the only way to do it conveniently. Index.html (View Page ) $.aja...