The server is php-and-mysql-available with the help of Webmin (a web-based unix system management tool). So there is no need for me to install mysql myself. What’s more, I have already a nodejs program available to run in my laptop (window OS) and the Baidu BAE (unix OS). Due to preassembled php program, the 80 port is employed and the root path for front-end files under 80 port is located in /home/username/public_html. To avoid confusion between php projects and nodejs projects, I created a new folder named “node-server” under /home/orzzone/ path. In a conclusion, I uploaded my Nodejs project files to the path ‘/home/username/node-server’.
After uploading operation was completed, I changed the current working directory to the path ‘/home/username/node-server’, and ran command “npm i” to install dependencies specified in package.json file. With all dependencies installed, I ran command “npm run start” to start my project which uses port 18080 instead of 80. All seems to go well with no error information jumped to the screen of my command line tool. But when I visited a api url through my web browser, it responsed with error information saying something as below:
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'cleveryun'@'orzzone.com' (using password: YES) at Handshake.Sequence._packetToError (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/sequences/Sequence.js:51:14) at Handshake.ErrorPacket (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/sequences/Handshake.js:103:18) at Protocol._parsePacket (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/Protocol.js:280:23) at Parser.write (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/Parser.js:74:12) at Protocol.write (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket.<anonymous> (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/Connection.js:109:28) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) -------------------- at Protocol._enqueue (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/Protocol.js:141:48) at Protocol.handshake (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/protocol/Protocol.js:52:41) at PoolConnection.connect (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/Connection.js:136:18) at Pool.getConnection (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/Pool.js:48:16) at Pool.query (/home/orzzone/node-server/node_modules/express-mysql-session/node_modules/mysql/lib/Pool.js:200:8) at MySQLStore.get (/home/orzzone/node-server/node_modules/express-mysql-session/lib/index.js:130:19) at session (/home/orzzone/node-server/node_modules/express-session/index.js:460:11) at Layer.handle [as handle_request] (/home/orzzone/node-server/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/home/orzzone/node-server/node_modules/express/lib/router/index.js:312:13) at /home/orzzone/node-server/node_modules/express/lib/router/index.js:280:7
Oh, what happend? The same mysql login parameter was availble for use in both my laptop and the online server provided by Baidu BAE. So I was sure that there is no error in the mysql login parameter. After half a day’s time-wasting, I found the problem. There were two anonymous mysql accounts! After I deleted the two accounts, the online nodejs program was available to communicate with mysql database normally.
A good day.